//FIM CRIACAO DO USER BOB
echo "<h4>registou o Bob <h4>";
//CRIACAO DO USER ALICE
// chave de encriptacao da chave privada
$passphrase_Alice = 'PASSWORD USADA PARA ENCRIPTAR A CHAVE PRIVADA DO ALICE';
//cria chave privada e certificado para o Alice
//"Distinguished Name" e necessario para a chave publica
$distinguishedName_Alice = array("countryName" => "US", "stateOrProvinceName" => "New York", "localityName" => "New York City", "organizationName" => "example.net", "organizationalUnitName" => "Pro PHP Security", "commonName" => "pps.safebook.com", "emailAddress" => "*****@*****.**");
$openSSL_Alice->makeKeys($distinguishedName_Alice, $passphrase_Alice);
//insere a Alice da Base de Dados
$database->insertUserDatabase($username_Alice, $password_Alice, $openSSL_Alice->getCertificateSerialNumber());
//FIM CRIACAO DO USER ALICE
echo "<h4>registou a Alice </h4>";
echo " <h1>PARTE 2 </h1>";
//extrai a chave publica do Bob
$public = $openSSL_Bob->certificate();
echo "<h4>extrai a chave publica do Bob </h4>";
//cria chave AES
$AES_key = bin2hex(openssl_random_pseudo_bytes(12, $cstrong));
echo '<h4>cria chave AES </h4>"' . $AES_key . '"';
//encripta a mensagem com a chave AES
$encrypted_message = $openSSL_Bob->encryptAES256($message, $AES_key);
echo '<h4>encripta a mensagem com a chave AES </h4>"' . $encrypted_message . '"';
//encripta a chave AES com a chave publica do Bob
$encrypted_AES_key = $openSSL_Bob->encrypt($AES_key);
echo '<h4>encripta a chave AES com a chave publica do Bob </h4>"' . $encrypted_AES_key . '"';
//assina a mensagem com chave privada da Alice
$mensagem_assinada = $openSSL_Alice->sign($encrypted_message, $passphrase_Alice);
echo '<h4>assina a mensagem com chave privada da Alice </h4>"' . $mensagem_assinada . '"';
//notifica o bob
$Bob = $database->findUserByCerticateSerialNumber($openSSL_Bob->getCertificateSerialNumber());
<br>
Your email address is: <?php 
echo $_POST["Password"];
?>

<?php 
// create a new openSSL object
include_once 'openSSL.php';
$openSSL = new openSSL();
// generate a keypair
$passphrase = 'This is a passphrase of reasonable length.';
// a "Distinguished Name" is required for the public key
$distinguishedName = array("countryName" => "US", "stateOrProvinceName" => "New York", "localityName" => "New York City", "organizationName" => "example.net", "organizationalUnitName" => "Pro PHP Security", "commonName" => "pps.example.net", "emailAddress" => "*****@*****.**");
$openSSL->makeKeys($distinguishedName, $passphrase);
$private = $openSSL->privateKey();
$public = $openSSL->certificate();
print "<h3>Key and Certificate Generation</h3>";
print "<p>Your certificate belongs to:<br />";
$openSSL->getCommonName() . "</p>";
print "<p>Distinguished Name:<br /><pre>";
print_r($openSSL->getDN(), 1) . "</pre></p>";
print "<p>Your private key is:<br /><pre>{$private}</pre></p>";
print "<p>Your public key is:<br /><pre>{$public}</pre></p>";
print "<p>Your certificate is signed by:<br />";
$openSSL->getCACommonName() . "</p>";
print "<p>CA Distinguished Name:<br /><pre>";
print_r($openSSL->getCA(), 1) . "</pre></p>";
print "<hr />";
// encrypt some text using the public key
$text = "The goat is in the red barn.";
$encrypted = $openSSL->encrypt($text);