Description
As I was discussing the raw AES keyring API with @juneb, it occurred to both of us that requiring the caller to specify the wrapping algorithm does not really add value here, because the only thing that changes is the key size, which we can infer from the wrapping key material.
I think that requiring the wrapping algorithm is a hold-over from RawMasterKey
, but one of the main reasons why the wrapping algorithm was needed to AES operations for that was to provide a consistent configuration experience for AES and RSA wrapping keys. Since we have split these out into separate keyrings, I do not think this really adds value anymore.
An argument could be made that specifying the wrapping algorithm adds value because it requires the caller to explicitly state what AES key size they intend to provide, which we can check against the key material that they actually provided. While technically correct, I'm not sure that this justifies the additional API complexity.
The other extant implementations vary on how they present this:
The specification only requires the key material:
C requires a separate statement of the expected key length:
Java only requires the key material:
Javascript requires a wrapping algorithm suite:
Option 1: Leave as-is
If we do this, we should change the validator for the wrapping algorithm suite to not allow RSA suites.
Option 2: Derive the wrapping algorithm suite from the wrapping key material
Given that the only thing that changes between the AES wrapping algorithm suites is the key size, we can enforce that the key material is a supported length and derive the wrapping suite from the key material length.
Option 3: Make the wrapping algorithm suite optional
We could make the wrapping algorithm suite optional, enforcing it if the caller provides it, but otherwise deriving it from the wrapping key material.