Decoding base64 encoded message with a key I am pentesting a database that where I found data which was base64 encoded. I tried the usual method of decoding base64, which didn't work.

Later, I found in database a field called base64_custom_key. How do I decrypt a base64 encoded message with a key?

For eg.
The key looks like gP9jOzA75VyIW6FRuHZimQcLB1rCTKpGN8hdEXw0eY3kMx+/JDUntsob4a2qfSv and the value generated looks like ucaUCo4NmA88Tws8BoQsKAXdBcDn
That's a simple substitution cipher. Base 64 uses the following alphabet A-Za-z0-9+/. Here A encodes  000000, B encodes 000001 etc. In your case the g encodes 000000, P encodes 000001 etc.

Instead of writing your own decoder for that you can simply take the ciphertext, iterate through the characters of the ciphertext and replace g with A, P with B etc. After that you should be able to use a regular base 64 decoder to do the work for you.

Don't replace multiple characters at a time or you'll run into trouble. Put the characters in a new string instead (if you map g to A while there are still other A characters left then your algorithm will certainly fail).