GPG no key for encryption set error in PHP Laravel
I get the PHP Error output: no key for encryption set
using GnuPG in Laravel.
My Controller:
public function showDecryptionForm()
{
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/user/.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'));
}
}
Whats the Error mean? The Key from Database or $gpg->addencryptkey
?
I have generated with gpg an keypair and export the public.key with fingerprint in the /home/user/.gnupg
folder. Are this Correct or must i do it on other way?
I am happy for any help.
Thanks……
from Laravel Questions and Answers https://laravelquestions.com/php/gpg-no-key-for-encryption-set-error-in-php-laravel/
via Lzo Media
No comments:
Post a Comment