You can actually use the public key as third parameter and not the certificate.
If you can't make it work, make sure that :
1) Your public key is well formatted. It seems that it must have the ----BEGIN PUBLIC KEY---- and ----END PUBLIC KEY----
2) Your signature is in binary format. You can use the php base64_decode for this.