Skip to content

Initializer

init(modulus:exponent:)

Initializes a new RSA key instance with modulus and exponent
init(modulus: String, exponent: String) throws

Parameters

modulus

The modulus of the RSA key, represented as a base64 URL encoded string.

exponent

The exponent of the RSA key, represented as a base64 URL encoded string.

Discussion

This initializer creates an RSA key using the modulus and exponent. All these parameters are expected to be base64 URL encoded strings.

Throws

  • JWTError/generic with the identifier `RSAKey`` if either the modulus or exponent cannot be decoded from their base64 URL encoded strings.

Note

  • The provided modulus and exponent are key components for creating RSA public keys.

  • The private exponent is an additional parameter required for creating RSA private keys.