Add own RSA key to realm via API

Hello folks,

I want to provide my own RSA key to a realm via API to sign tokens. I already searched for similar topics but didnt succeed with the proposed answers.

Playing with the admin cli brought me to ‘kcadm.sh create components -r testrealm -s name=rsa -s providerId=rsa -s providerType=org.keycloak.keys.KeyProvider’ so far but asks for the key.
Where can I look up the arguments for a valid key request and is the command directly translatable to json?

Alright, I found it out myself. All attributes regarding key import can be found here: keycloak/Attributes.java at 10c3e149d36d0be1e421ff149359c854cc0ed8f0 · keycloak/keycloak · GitHub

To make it work remove PEM header and footer from both key and certificate.

The cli command then looks like: kcadm.sh create components -r testrealm -s name=rsa -s providerId=rsa -s providerType=org.keycloak.keys.KeyProvider -s ‘config.privateKey=["$key"]’ -s ‘config.certificate=["$certificate"]’