JWK.parseFromPEMEncodedObject
method can take care of that. It parses astring of one or more of the following PEM-encoded objects to create an RSA orEC JWK:BEGIN CERTIFICATE
)BEGIN RSA PUBLIC KEY
)BEGIN PUBLIC KEY
)BEGIN RSA PRIVATE KEY
)BEGIN PRIVATE KEY
)