So i tried to verify rsa-ps signature that signed in golang with php library phpseclib v3. The php verification keep getting me an error. But what makes me confuse is when i try sign the signature in php and verify that in both golang and php it works.
this is the code that i use for sign and verify the signature in golang
Sign signature
rng := rand.Reader
rsa.SignPSS(rng, key, crypto.SHA256, digest, nil)
Verify signature
rsa.VerifyPSS(key, crypto.SHA256, digest, signature, nil)
and this is the code to verify and sign the signature in php
Verify signature
$key = RSA::loadPublicKey('the key');
$result = $key->withHash('sha256')->withMGFHash('sha256')->verify($message, $signature);
Sign signature
$key = RSA::loadPrivateKey('the key');
$key = $private->withPadding(RSA::SIGNATURE_PSS);
$signature = $private->withHash('sha256')->withMGFHash('sha256')->sign($message);
NOTE The value of signature return in encrypted base64 and i already decrypt the value before verify the signature
Anyone can explain hows that happen ? and what should i do to make it works for both ?