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 support for additional SHA2 hashes in RawMasterKey RSA-OAEP-MGF1 wrapping algorithms #56

Closed
mattsb42-aws opened this issue Jun 20, 2018 · 1 comment

Comments

@mattsb42-aws
Copy link
Member

Problem

RawMasterKey provides a compatible implementation of the behavior exhibited by the JceMasterKey provided in the AWS Encryption SDK for Java. Unfortunately, because we did not define constraints for JceMasterKey, when used with an RSA keypair it will accept any JCE Standard Name wrapping algorithm for RSA. This is only constrained by the Standard Names that your JCE Provider supports.

RawMasterKey, by way of WrappingAlgorithm, is much more opinionated and will only accept the specific algorithms that we have pre-defined. This list was defined as PKCS1v15, OAEP-MGF1-SHA1, and OAEP-MGF1-SHA256 because those are the only algorithms defined in the JCE implementation requirements.

We will explicitly not be supporting all possible algorithms for several reasons, including but not limited to:

  1. No constraints are set in the JCE specification, so any JCE Provider could in theory support any names that they want to, including fully custom names/algorithms.
  2. Some commonly supported algorithms, such as some supported by the SunJCE Provider, we explicitly will never support. These include NoPadding and OAEP-MGF1-MD5.
  3. We do need to at some point better define the constraints of algorithms allowed be JceMasterKey. What exactly that will look like, especially considering compatibility requirements, remains to be seen and requires discussion.

Solution

We should add allowed WrappingAlgorithm definitions for RSA-OAEP-MGF1 with additional valid SHA2 algorithms. We should at least add SHA512. Whether we should add SHA384/etc is pending discussion.

@mattsb42-aws
Copy link
Member Author

Copying here for reference from aws/aws-encryption-sdk-java#56

Allow

  • RSA/ECB/PKCS1Padding - Required in the [JCE Implementation Requirements][2]
  • RSA/ECB/OAEPWithSHA-1AndMGF1Padding - Required in the [JCE Implementation Requirements][2]
  • RSA/ECB/OAEPWithSHA-256AndMGF1Padding - Required in the [JCE Implementation Requirements][2]
  • RSA/ECB/OAEPWithSHA-384AndMGF1Padding - Secure and reasonably common.
  • RSA/ECB/OAEPWithSHA-512AndMGF1Padding - Secure and already used by at least one AWS service.

Already supported:

  • PKCS1
  • OAEP with SHA1 and MGF1 with SHA1
  • OAEP with SHA256 and MGF1 with SHA256

To be added:

  • OAEP with SHA384 and MGF1 with SHA384
  • OAEP with SHA512 and MGF1 with SHA512

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

No branches or pull requests

1 participant