コード例 #1
0
 /**
  * Tests JCryptCipherRijndael256Test->generateKey()
  *
  * @return  void
  *
  * @since   12.1
  */
 public function testGenerateKey()
 {
     $key = $this->_cipher->generateKey();
     // Assert that the key is the correct type.
     $this->assertInstanceOf('JCryptKey', $key);
     // Assert that the private key is 32 bytes long.
     $this->assertEquals(32, strlen($key->private));
     // Assert the key is of the correct type.
     $this->assertAttributeEquals('rijndael256', 'type', $key);
 }
コード例 #2
0
ファイル: proof.php プロジェクト: xop32/Proof-of-Identity
 protected function generateKeys()
 {
     // Generate a password that will be used to encrypt the file.
     jimport("itprism.string");
     $length = rand(16, 32);
     $password = new ITPrismString();
     $password->generateRandomString($length);
     // Generate a salt.
     $length = rand(16, 32);
     $salt = new ITPrismString();
     $salt->generateRandomString($length);
     $options = array("salt" => (string) $salt, "password" => (string) $password);
     $chiper = new JCryptCipherRijndael256();
     $key = $chiper->generateKey($options);
     return array("private" => $key->private, "public" => $key->public);
 }