Ejemplo n.º 1
9
 function rsa_kyp_verify($message, $public_key, $modulus, $keylength)
 {
     $number = RSA::binary_to_number($message);
     $decrypted = RSA::pow_mod($number, $public_key, $modulus);
     $result = RSA::number_to_binary($decrypted, $keylength / 8);
     return RSA::remove_KYP_padding($result, $keylength / 8);
 }
Ejemplo n.º 2
0
 public function __construct($xmlRsakey = null, $type = null)
 {
     $xmlObj = null;
     if ($xmlRsakey == null) {
         $xmlObj = simplexml_load_file("xmlfile/RSAKey.xml");
     } elseif ($type == 0) {
         $xmlObj = simplexml_load_file($xmlRsakey);
     } else {
         $xmlObj = simplexml_load_string($xmlRsakey);
     }
     $this->modulus = RSA::binary_to_number(base64_decode($xmlObj->Modulus));
     $this->public_key = RSA::binary_to_number(base64_decode($xmlObj->Exponent));
     $this->private_key = RSA::binary_to_number(base64_decode($xmlObj->D));
     $this->key_length = strlen(base64_decode($xmlObj->Modulus)) * 8;
 }