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

WIP: soft: Decrypt arbitrary data using pkey #27

Closed
wants to merge 1 commit into from

Conversation

dmulder
Copy link
Collaborator

@dmulder dmulder commented Dec 18, 2023

Builds, but in testing it fails to decrypt a blob that was supposedly encrypted using my public key. Will need to investigate further.

Checklist

  • This pr contains no AI generated code
  • cargo fmt has been run
  • cargo clippy has been run and there's no issues
  • cargo test has been run and passes

src/soft.rs Outdated
}
};

decrypter
Copy link
Member

Choose a reason for hiding this comment

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

You only need this on RSA, not ECDSA.

There are also a few styles of RSA padding, https://docs.rs/openssl/latest/openssl/rsa/struct.Padding.html which may be important here especially since in the JWE it specifically calls out RSA-OAEP which likely indicates your padding mode should be https://docs.rs/openssl/latest/openssl/rsa/struct.Padding.html#associatedconstant.PKCS1_OAEP. I'm not sure what the function signature should look like for that, since some key types don't need padding, some do. Maybe we just make our own Padding enum that maps the various options in the openssl version?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Added this to testing, and it fails for ecdsa with "operation not supported for this keytype".

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It's failing initializing the Encrypter.

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.

2 participants