Esempio n. 1
0
 public function testConstructorLoadsPassphrasedKeys()
 {
     $rsa = new Zend_Crypt_Rsa();
     $config = array('privateKeyBits' => 512, 'passPhrase' => '0987654321');
     $keys = $rsa->generateKeys($config);
     try {
         $rsa = new Zend_Crypt_Rsa(array('passPhrase' => '0987654321', 'pemString' => $keys->privateKey->toString()));
     } catch (Zend_Crypt_Exception $e) {
         $this->fail('Passphrase loading failed of a private key');
     }
 }
Esempio n. 2
0
 public function testConstructorLoadsPassphrasedKeys()
 {
     $rsa = new Zend_Crypt_Rsa();
     // check to see if openssl.cnf can be found by trying to generate a key
     $test = openssl_pkey_new();
     if (!$test) {
         $this->markTestSkipped('Cannot generate a private key with openssl_pkey_new()');
     }
     $config = array('privateKeyBits' => 512, 'passPhrase' => '0987654321');
     $keys = $rsa->generateKeys($config);
     try {
         $rsa = new Zend_Crypt_Rsa(array('passPhrase' => '0987654321', 'pemString' => $keys->privateKey->toString()));
     } catch (Zend_Crypt_Exception $e) {
         $this->fail('Passphrase loading failed of a private key');
     }
 }