Knowledge Base
Authentication is disabled (development mode).

Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead

Edit

apt apt-key gpg key keyring store trust trusted

-wget -qO- https://myrepo.example/myrepo.asc | sudo apt-key add -
+wget -qO- https://myrepo.example/myrepo.asc | sudo tee /etc/apt/trusted.gpg.d/myrepo.asc
 curl -fsSL https://apt.releases.hashicorp.com/gpg |
-sudo apt-key add -
+sudo gpg --dearmor -o /etc/apt/keyrings/hashicorp-archive-keyring.gpg

Make sure to use the "asc" extension for ASCII armored keys and the "gpg" extension for the binary OpenPGP format.

Recommended: Instead of placing keys into the /etc/apt/trusted.gpg.d directory, you can place them anywhere on your filesystem by using the Signed-By option in your sources.list and pointing to the filename of the key:
Legacy format:

deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ noble main

DEB822-formatted:

Types: deb
URIs: http://security.ubuntu.com/ubuntu
Suites: noble-security
Components: main universe restricted multiverse
Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg

How To Handle apt-key and add-apt-repository Deprecation Using gpg to Add External Repositories on Ubuntu 22.04