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

at_c: encryption_key_helpers should pass on raw bytes form of shared key to avoid unnecessary base64 decodes #225

Closed
Tracked by #155
JeremyTubongbanua opened this issue May 7, 2024 · 1 comment
Assignees

Comments

@JeremyTubongbanua
Copy link
Member

JeremyTubongbanua commented May 7, 2024

This is the header file for encryption_key_helpers.h at the moment.

int atclient_get_shared_encryption_key_shared_by_me(atclient *ctx, const atclient_atsign *recipient,
                                                    char *enc_key_shared_by_me, bool create_new_if_not_found);


int atclient_get_shared_encryption_key_shared_by_other(atclient *ctx, const atclient_atsign *recipient,
                                                       char *enc_key_shared_by_other);

int atclient_create_shared_encryption_key(atclient *ctx, atclient_connection *root_conn,
                                          const atclient_atsign *recipient, char *enc_key_shared_by_me);


int atclient_get_public_encryption_key(atclient *ctx, const atclient_atsign *atsign,
                                       char *public_encryption_key);

int atclient_create_shared_encryption_key_pair_for_me_and_other(atclient *atclient, const atclient_atsign *sharedby,
                                                                const atclient_atsign *sharedwith,
                                                                char *sharedenckeybyme);

At the moment, we take char *enc_key_.. which will be the output buffer to hold the 44-length shared aes encryption key which would be encrypted in base64.

I think this should be refactored to unsigned char *sharedenckey which will hold a buffer of size 32 bytes which will hold a non-base64 encoded AES key. That way, we can save the operation of 1. encoding it to output (internally in the function) and 2. decoding the key for use (externally by the caller)

@JeremyTubongbanua
Copy link
Member Author

Closed by #337

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

No branches or pull requests

1 participant