Comments (7)
https://github.com/singpolyma/openpgp-php/blob/master/examples/encryptDecrypt.php
Shows encrypt/decrypt using a key. To use a passphrase instead, send the encrypt function an array containing strings. Or you can do both passphrases and keys by mixing them in the array.
from openpgp-php.
Can you please give me a full example for my case?
- I want to generate a public and private key based on a keypair (EMAIL + PASSPHRASE or just passphrase)
- Encrypt a message (TEXT, not file. When i ::parsestring public key from keygen i get an error) using public key generated from step 1
- Decrypt message using private key and PASSPHRASE from step 1
Thank you again for the reply
PS: Also the encryptdecrypt.php uses the same key. Shouldnt Encryption use the public key, and decryption dhe private key?? @singpolyma
from openpgp-php.
This might help you, assuming you already have your way of generating keys:
I have set up an example in a unit test file you can place in your project and play around with.
@singpolyma You might want to change the example to draw from separate sources for the public and private key to make the example more obvious. I got confused by the "OpenPGP_Crypt_Symmetric" for a sec, too.
Regards
Hoffstadt
from openpgp-php.
Shouldnt Encryption use the public key, and decryption dhe private key??
Every OpenPGP secret key contains a full copy of the public key, so if you happen to have the secret key in memory already you can use to for encryption to save a step, which is what the example is doing. Of course, if you only have the public key then you can use that for encryption just fine as well.
from openpgp-php.
How can I convert binary encryption to ascii?
from openpgp-php.
@singpolyma i had generated public and private key for test from https://pgpkeygen.com/
while decrypting message it always throw
ErrorException {#1227
#message: "Undefined index: d"
#code: 0
#file: "vendor/singpolyma/openpgp-php/lib/openpgp_crypt_rsa.php"
with my private key i did not know why convert_key function celled
from openpgp-php.
This issue is attracting unrelated questions and the original question I believe has been answered, so I'm going to close it for now. If the original poster believes the question is not answered, please comment to reopen. Others can open new issues for new questions, please.
from openpgp-php.
Related Issues (20)
- Can't decrypt pgp ciphers from other clients HOT 1
- Encryption HOT 1
- PHP8 and thoughts on minimum PHP version HOT 2
- New tagged release version HOT 3
- Cant decrypt on CLI HOT 1
- Encrypt stream or chunks
- Not an asymmetrically encrypted message when trying to decrypt
- Support for phpseclib3 HOT 4
- Bump version to php 7.3? HOT 1
- Generated public keys cannot be imported into Thunderbird OpenPGP Key Manager HOT 6
- Need help with decrypting a file HOT 1
- getCipher algo number 1 HOT 1
- Please implement a "sop" (Stateless OpenPGP Command Line) interface HOT 2
- Multiple recipients when should be single HOT 3
- Error: Ciphertext representative out of range HOT 1
- Does this work out-the-box with laravel? HOT 9
- OpenPGP_PublicSubkeyPacket in SubKey exemple? HOT 1
- Documentation? HOT 1
- Cannot decrypt messages encoded with GPG
- encrypt and sign HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from openpgp-php.