Esempio n. 1
0
File: RSA.php Progetto: stunti/zf2
 /**
  * Sign a request
  * 
  * @param  array $params 
  * @param  null|string $method 
  * @param  null|string $url 
  * @return string
  */
 public function sign(array $params, $method = null, $url = null)
 {
     $rsa = new RSAEncryption();
     $rsa->setHashAlgorithm($this->_hashAlgorithm);
     $sign = $rsa->sign($this->_getBaseSignatureString($params, $method, $url), $this->_key, RSAEncryption::BASE64);
     return $sign;
 }
Esempio n. 2
0
 public function testConstructorLoadsPassphrasedKeys()
 {
     $rsa = new RSA();
     $config = array('privateKeyBits' => 512, 'passPhrase' => '0987654321');
     $keys = $rsa->generateKeys($config);
     try {
         $rsa = new RSA(array('passPhrase' => '0987654321', 'pemString' => $keys->privateKey->toString()));
     } catch (Crypt\Exception $e) {
         $this->fail('Passphrase loading failed of a private key');
     }
 }