How do I resolve decryption failures (Artifactory failed to initialize: check Artifactory logs for errors 500 error)? How can I get a missing artifactory.key file?

The artifactory.key file is the file with the password-decryption information.  If this file is missing, Artifactory will not be able to decrypt encrypted passwords.  By default it is located in '$ARTIFACTORY_HOME/etc/security/', although you can modify the '' configuration file as explained here to change this location.  

To solve the problem, rename the last created 'artifactory.key.*' file in the security folder,

For example: change artifactory.key.<time stamp> to just artifactory.key and then press decrypt via the UI.

If the file is not in the default location, and you have not altered your configuration file, try doing a search for it such as the one below:

$ sudo find / -name artifactory.key*

You may find it located in a directory like "/private/var/root/.artifactory/etc/security".  This case can be a little tricky, as attempting to navigate to the directory of interest, even using sudo, can be odd/confusing.

For example note the following command-line interaction:

$ sudo cd /private/var/root/.artifactory/etc/security

$ pwd


This is not the directory that you tried to reach, and artifactory.key isn't found here.  However, we can see the files and manipulate them like this instead:

sudo ls -la /private/var/root/.artifactory/etc/security 

total 16

drwx------   4 root  wheel  136 Apr  3 11:03 .

drwxr-xr-x  21 root  wheel  714 Apr  3 11:03 ..

-rw-r--r--   1 root  wheel  610 Apr  3 10:49 artifactory.key.201504031102057

$ sudo cp /private/var/root/.artifactory/etc/security/artifactory.key.201504031102057 /private/var/root/.artifactory/etc/security/artifactory.key 

$ sudo ls -la /private/var/root/.artifactory/etc/security

total 24

drwx------   5 root  wheel  170 Apr  3 12:43 .

drwxr-xr-x  21 root  wheel  714 Apr  3 11:03 ..

-rw-r--r--   1 root  wheel  608 Apr  3 11:03 artifactory.key

-rw-r--r--   1 root  wheel  610 Apr  3 10:49 artifactory.key.201504031102057

See Encryption/Decryption in Artifactory

If it still does not resolve the issue, then it could be because the key does not match or has been corrupted. Please use following steps to restore Artifactory:

1. Stop Artifactory

2. Edit $ARTIFACTORY_HOME/etc/ => enter plain text password => Save it as the same name

3. Edit $ARTIFACTORY_HOME/etc/artifactory.config.latest.xml => enter plain text password for LDAP (search "managerPassword") or If you do not know the password, disable it temporarily by changing "enabled" from true to false => Save it as "artifactory.config.import.xml"

4. Start Artifactory

5. Go to Admin => Security => General => Encrypt