If the outbound access is allowed only to the Artifactory from the server, you can download the key from the provider and upload it to your Artifactory Generic local repository and use that path in your yum repo configuration file.
Example for yum:
Example for Apt:
Ref: https://www.jfrog.com/confluence/display/JFROG/RPM+Repositories#RPMRepositories-RemoteRepositories
https://www.elastic.co/guide/en/elasticsearch/reference/8.6/deb.html
https://www.jfrog.com/confluence/display/JFROG/Debian+Repositories
Example for yum:
rpm --import http://username:password@artifactory_host/artifactory/mypubkeys/GPG-KEY-elasticsearch.keyHere, mypubkeys is a Generic local repository I created in the Artifactory.
Example for Apt:
curl http://username:password@artifactory_host/artifactory/mypubkeys/GPG-KEY-elasticsearch.key|gpg --dearmor >/usr/share/keyrings/elasticsearch-keyring.gpg
Ref: https://www.jfrog.com/confluence/display/JFROG/RPM+Repositories#RPMRepositories-RemoteRepositories
https://www.elastic.co/guide/en/elasticsearch/reference/8.6/deb.html
https://www.jfrog.com/confluence/display/JFROG/Debian+Repositories