PHP rsa gePublicKey from .pem file

Posted by mazheruddin on Stack Overflow See other posts from Stack Overflow or by mazheruddin
Published on 2011-01-10T17:48:13Z Indexed on 2011/01/10 17:53 UTC
Read the original article Hit count: 134

Filed under:
|

Trying to verify received signature with following code.

$file = "C:\key_file.pem"; 
$keypair = Crypt_RSA_KeyPair::fromPEMString(file_get_contents($file));
$public_key = $keypair->getPublicKey();
$rsa_pub_key = Crypt_RSA_Key::fromString($public_key->toString()); 
$rsa_obj = new Crypt_RSA;
$verify_status =  $rsa_obj->validateSign($text,$recieved_signed_sign, $rsa_pub_key) ? 'valid' : 'invalid';

getting error as

Fatal error: Call to undefined method PEAR_Error::getPublicKey() in C:\Program Files\xxxx\rsa.php

© Stack Overflow or respective owner

Related posts about php

Related posts about rsa