We currently offer APIs to construct RSA keys from PEM and DER representations but we have no way of constructing they key from its constituent RSA parameters: n and e for public keys, and n, e, d, p, and q for private keys. Sometimes these are what you have to hand, e.g. in a JSON Web Key.
Modifications
Provide initializers for RSA keys from RSA parameters for all the RSA key types.
To implement this, we leverage the fact that we are making use of BoringSSL in _CryptoExtras on all platforms. We need this because there are no APIs to construct the underlying key type on Darwin platforms from these parameters. So we do this by first creating a BoringSSL key, serializing it to PEM format, and then constructing a platform-specific key from the PEM representation.
Result
New APIs to construct RSA keys from RSA parameters.
Motivation
We currently offer APIs to construct RSA keys from PEM and DER representations but we have no way of constructing they key from its constituent RSA parameters: n and e for public keys, and n, e, d, p, and q for private keys. Sometimes these are what you have to hand, e.g. in a JSON Web Key.
Modifications
Provide initializers for RSA keys from RSA parameters for all the RSA key types.
To implement this, we leverage the fact that we are making use of BoringSSL in
_CryptoExtras
on all platforms. We need this because there are no APIs to construct the underlying key type on Darwin platforms from these parameters. So we do this by first creating a BoringSSL key, serializing it to PEM format, and then constructing a platform-specific key from the PEM representation.Result
New APIs to construct RSA keys from RSA parameters.