Identity not found when trying to code-sign an application with a certificate
This is not the explanation of the problem but the way I worked around to solve it:


Deleted the previously created certificates.
Unlocked the System keychain with the keychain Access tool (locker on the left).
Recreated the certificates filling most of the fields of information even if not totally required.
Switched to a simple and clean terminal (just in case a modified terminal lacked some kind of access to the keychain)
Executed the codesigning commands with sudo


This worked for me, but I don't really understand what was causing the problem previously.