I dont understand why i can generate PGP keys and also encrypt it with GnuPG v1 but not in my Laravel Script:
Controller:
$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>
Text field is empty.
Must i echo or Print $enc
on other way?
Gnupg is installed and i can enrypt in Terminal keys.
Thanks
from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/2DZqx9G
via IFTTT
Aucun commentaire:
Enregistrer un commentaire