init(pem:)

Creates anRSA.PrivateKey from private key PEM file in Data format.

RSA.swift:256
init(pem data: some DataProtocol) throws

Parameters

pem

Contents of PEM file.

Throws

RSAError/keySizeTooSmall if the key size is less than 2048 bits.

Private key PEM files look like:

-----BEGIN PRIVATE KEY-----
MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC0cOtPjzABybjzm3fCg1aCYwnx
...
aX4rbSL49Z3dAQn8vQIDAQAB
-----END PRIVATE KEY-----

This key can be used to verify and sign JWTs.