Skip to content
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

feat: (c sshnpd) rejection notification #1168

Draft
wants to merge 7 commits into
base: trunk
Choose a base branch
from

Conversation

realvarx
Copy link
Contributor

@realvarx realvarx commented Jun 26, 2024

- What I did

  • Created_response_atkey and notify methods for code reuse
  • Signature verification rejection notification

- How I did it

- How to verify it
If we intentionally modify the signature value to make it incorrect, we can see what it happens:

value[0] = 'A';

  res = verify_envelope_signature(requesting_atsign_publickey, (const unsigned char *)payloadstr,
                                  (unsigned char *)value, hashing_algo_str, signing_algo_str);
  if (res != 0) {

    // Notify noports client that this session is NOT connected
    memset(value, 0, valuelen);
    snprintf(value, valuelen, "Signature verification failed: %d\n", res);
    atclient_atkey error_res_atkey;
    atclient_atkey_init(&error_res_atkey);

    create_response_atkey(&error_res_atkey, atsign, requesting_atsign,
                                 identifier, keyname, &keynamelen);

    notify(atclient, atclient_lock, &error_res_atkey, value);
    atclient_atkey_free(&error_res_atkey);

    atlogger_log(LOGGER_TAG, ATLOGGER_LOGGING_LEVEL_ERROR, "Failed to verify envelope signature\n");
    free(envelope);
    atchops_rsakey_publickey_free(&requesting_atsign_publickey);

    return;
  }

image

- Description for the changelog

Closes #1117

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

feat (c sshnpd): send rejection notification to client when errors occur
1 participant