Hello,
I have finally found the solution with a little help from my friend. It was all caused by calling it with sudo. Removing sudo from productsign call, it started working.
I have absolutely no idea why this worked correctly for one certificate and not for the second one with the sudo.