vendredi 2 février 2018

Using GnuPG in PHP Issue

I have an Problem to encrypt an Key. Theres nothing display in my Laravel Script. It dont generate the PGP Key, just empty field.

I using Debian with Nginx and php5.

My Controller:

{
  if(session()->has('user_name'))
  {
    $user_name = session()->get('user_name');
    $user_password = session()->get('user_password');
  }
  else
  {
    return redirect()->route('login');
  }
  $user_details = User::where('username',$user_name)->first();

  $secret = $this->generateSecretKey();

  $secret_hash = password_hash($secret, PASSWORD_BCRYPT);

  $this->secret_code = $secret_hash;

  //echo $user_details->pgp;

  putenv("GNUPGHOME =/home/.gnupg");
  $gpg = new gnupg();
  $key = $gpg->import($user_details->pgp);
  $gpg->addencryptkey($key['fingerprint']);
  $enc = $gpg->encrypt($secret);
  $gpg->clearencryptkeys();
  //echo '<textarea rows="30" class="form-control" name="pgp-msg">'.$enc.'</textarea>';

  session()->flash('secret_hash',$secret_hash);

  return view('auth.decryptionform',compact('enc','user_name','user_password'));
}

My blade:

   <textarea name="message" id="message" class="form-control" rows="15" cols="40" readonly></textarea>

I hope someone can help me..



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire