mirror of
https://gitlab.com/spectre.app/cli.git
synced 2024-11-01 02:41:44 +01:00
Add test cases to test personal type passwords as well.
[ADDED] Support for personal type passwords in the standard test cases.
This commit is contained in:
parent
5c1924eb6f
commit
c47d6074c1
2 changed files with 50 additions and 8 deletions
|
@ -73,6 +73,16 @@
|
|||
<resultType>Phrase</resultType>
|
||||
<result>re monnu mit jededda</result>
|
||||
</case>
|
||||
<case id="v3_type_personal" parent="v3">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>IfzlLN4J7XNazwSa17xB7A==</resultParam>
|
||||
<result>password</result>
|
||||
</case>
|
||||
<case id="v3_type_personal_mb" parent="v3">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>det+TQ+yVcDxLZ30EE7hMw==</resultParam>
|
||||
<result>⛄</result>
|
||||
</case>
|
||||
<case id="v3_counter_ceiling" parent="v3">
|
||||
<keyCounter>4294967295</keyCounter>
|
||||
<result>ZurdYoda6:Jogs</result>
|
||||
|
@ -139,6 +149,16 @@
|
|||
<resultType>Phrase</resultType>
|
||||
<result>re monnu mit jededda</result>
|
||||
</case>
|
||||
<case id="v2_type_personal" parent="v2">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>IfzlLN4J7XNazwSa17xB7A==</resultParam>
|
||||
<result>password</result>
|
||||
</case>
|
||||
<case id="v2_type_personal_mb" parent="v2">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>det+TQ+yVcDxLZ30EE7hMw==</resultParam>
|
||||
<result>⛄</result>
|
||||
</case>
|
||||
<case id="v2_counter_ceiling" parent="v2">
|
||||
<keyCounter>4294967295</keyCounter>
|
||||
<result>ZurdYoda6:Jogs</result>
|
||||
|
@ -205,6 +225,16 @@
|
|||
<resultType>Phrase</resultType>
|
||||
<result>re monnu mit jededda</result>
|
||||
</case>
|
||||
<case id="v1_type_personal" parent="v1">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>IfzlLN4J7XNazwSa17xB7A==</resultParam>
|
||||
<result>password</result>
|
||||
</case>
|
||||
<case id="v1_type_personal_mb" parent="v1">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>det+TQ+yVcDxLZ30EE7hMw==</resultParam>
|
||||
<result>⛄</result>
|
||||
</case>
|
||||
<case id="v1_counter_ceiling" parent="v1">
|
||||
<keyCounter>4294967295</keyCounter>
|
||||
<result>ZurdYoda6:Jogs</result>
|
||||
|
@ -271,6 +301,16 @@
|
|||
<resultType>Phrase</resultType>
|
||||
<result>ne xoccu tix fepepla</result>
|
||||
</case>
|
||||
<case id="v0_type_personal" parent="v0">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>IfzlLN4J7XNazwSa17xB7A==</resultParam>
|
||||
<result>password</result>
|
||||
</case>
|
||||
<case id="v0_type_personal_mb" parent="v0">
|
||||
<resultType>Personal</resultType>
|
||||
<resultParam>det+TQ+yVcDxLZ30EE7hMw==</resultParam>
|
||||
<result>⛄</result>
|
||||
</case>
|
||||
<case id="v0_counter_ceiling" parent="v0">
|
||||
<keyCounter>4294967295</keyCounter>
|
||||
<result>WunoRopz1!Fovw</result>
|
||||
|
|
|
@ -100,6 +100,7 @@ int main(int argc, char *const argv[]) {
|
|||
xmlChar *siteName = spectre_xmlTestCaseString( testCase, "siteName" );
|
||||
SpectreCounter keyCounter = (SpectreCounter)spectre_xmlTestCaseInteger( testCase, "keyCounter" );
|
||||
xmlChar *resultTypeString = spectre_xmlTestCaseString( testCase, "resultType" );
|
||||
xmlChar *resultParam = spectre_xmlTestCaseString( testCase, "resultParam" );
|
||||
xmlChar *keyPurposeString = spectre_xmlTestCaseString( testCase, "keyPurpose" );
|
||||
xmlChar *keyContext = spectre_xmlTestCaseString( testCase, "keyContext" );
|
||||
xmlChar *result = spectre_xmlTestCaseString( testCase, "result" );
|
||||
|
@ -115,13 +116,13 @@ int main(int argc, char *const argv[]) {
|
|||
if (strstr((char *)id, argv[optind]) == (char *)id)
|
||||
selected = true;
|
||||
if (!selected)
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
fprintf( stdout, "test case %s... ", id );
|
||||
if (!xmlStrlen( result )) {
|
||||
fprintf( stdout, "abstract." );
|
||||
continue;
|
||||
fprintf( stdout, "abstract.\n" );
|
||||
break;
|
||||
}
|
||||
|
||||
// 1. calculate the user key.
|
||||
|
@ -129,23 +130,23 @@ int main(int argc, char *const argv[]) {
|
|||
(char *)userName, (char *)userSecret, algorithm );
|
||||
if (!userKey) {
|
||||
ftl( "Couldn't derive user key." );
|
||||
abort();
|
||||
break;
|
||||
}
|
||||
|
||||
// Check the user key.
|
||||
if (!spectre_id_equals( &keyID, &userKey->keyID )) {
|
||||
++failedTests;
|
||||
fprintf( stdout, "FAILED! (keyID: got %s != expected %s)\n", userKey->keyID.hex, keyID.hex );
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// 2. calculate the site password.
|
||||
const char *testResult = spectre_site_result(
|
||||
userKey, (char *)siteName, resultType, NULL, keyCounter, keyPurpose, (char *)keyContext );
|
||||
userKey, (char *)siteName, resultType, (char *)resultParam, keyCounter, keyPurpose, (char *)keyContext );
|
||||
spectre_free( &userKey, sizeof( *userKey ) );
|
||||
if (!testResult) {
|
||||
ftl( "Couldn't derive site password." );
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
|
||||
// Check the site result.
|
||||
|
@ -153,7 +154,7 @@ int main(int argc, char *const argv[]) {
|
|||
++failedTests;
|
||||
fprintf( stdout, "FAILED! (result: got %s != expected %s)\n", testResult, result );
|
||||
spectre_free_string( &testResult );
|
||||
continue;
|
||||
break;
|
||||
}
|
||||
spectre_free_string( &testResult );
|
||||
|
||||
|
@ -166,6 +167,7 @@ int main(int argc, char *const argv[]) {
|
|||
xmlFree( userSecret );
|
||||
xmlFree( siteName );
|
||||
xmlFree( resultTypeString );
|
||||
xmlFree( resultParam );
|
||||
xmlFree( keyPurposeString );
|
||||
xmlFree( keyContext );
|
||||
xmlFree( result );
|
||||
|
|
Loading…
Reference in a new issue