GithubHelp home page GithubHelp logo

EXAMPLE PLEASE!!! about openpgp-php HOT 7 CLOSED

singpolyma avatar singpolyma commented on August 14, 2024
EXAMPLE PLEASE!!!

from openpgp-php.

Comments (7)

singpolyma avatar singpolyma commented on August 14, 2024 2

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.

krisidmisso avatar krisidmisso commented on August 14, 2024 2

Can you please give me a full example for my case?

  1. I want to generate a public and private key based on a keypair (EMAIL + PASSPHRASE or just passphrase)
  2. Encrypt a message (TEXT, not file. When i ::parsestring public key from keygen i get an error) using public key generated from step 1
  3. 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.

DarkWyvern avatar DarkWyvern commented on August 14, 2024 2

This might help you, assuming you already have your way of generating keys:

Test Example

I have set up an example in a unit test file you can place in your project and play around with.

@krisidmisso

@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.

singpolyma avatar singpolyma commented on August 14, 2024 1

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.

kglazov avatar kglazov commented on August 14, 2024

How can I convert binary encryption to ascii?

from openpgp-php.

elhawy121994 avatar elhawy121994 commented on August 14, 2024

@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.

singpolyma avatar singpolyma commented on August 14, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.