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

Add signing and verification to encrypt_message/decrypt_message #59

Merged
merged 1 commit into from Sep 22, 2023

Conversation

jagerman
Copy link
Member

This redoes how we encode the result of encrypt_message to add sender identify and verification (entirely contained within libsession). These functions now produce/consume:

encrypted(
    padded(
        bt-encoded(
            possibly-compressed-data,
            sender-ed25519-pubkey,
            ed25519-signature
        )
    )
)

with signature verification on decryption.

The decryption function thus now returns a pair instead of an optional value: the session id, and the original value, assuming that value was signed by the session id. Upon failure for any reason, an exception is thrown (rather than, previously, returning a nullopt without any way to get an informative reason for the failure for diagnostics).

This redoes how we encode the result of encrypt_message to add sender
identify and verification (entirely contained within libsession).  These
functions now produce/consume:

    encrypted(
        padded(
            bt-encoded(
                possibly-compressed-data,
                sender-ed25519-pubkey,
                ed25519-signature
            )
        )
    )

with signature verification on decryption.

The decryption function thus now returns a pair instead of an optional
value: the session id, and the original value, assuming that value was
signed by the session id.  Upon failure for any reason, an exception is
thrown (rather than, previously, returning a nullopt without any way to
get an informative reason for the failure for diagnostics).
@jagerman jagerman mentioned this pull request Sep 22, 2023
@jagerman jagerman merged commit 09cf02b into oxen-io:dev Sep 22, 2023
1 check passed
/// - tagged with the user's underlying session Ed25519 pubkey (from which the session id can be
/// computed).
/// - all of the above encoded into a bt-encoded dict
/// - suffix-padded with null bytes so that the final output value will be a multiple of 256
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

are you using different padding methods for config messages and regular messages on purpose ?

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.

None yet

2 participants