Giter Site home page Giter Site logo

Displaying message about openpgp-php HOT 10 CLOSED

singpolyma avatar singpolyma commented on August 14, 2024
Displaying message

from openpgp-php.

Comments (10)

singpolyma avatar singpolyma commented on August 14, 2024

call to_bytes on the message. Use the ASCII armour helpers on the resulting bytes if you want that.

from openpgp-php.

lukaisailovic avatar lukaisailovic commented on August 14, 2024

@singpolyma Hmm looks like I'm doing something wrong, when I try to decrypt it (using windows software) I get no data.
This is my code:

$key = OpenPGP_Message::parse(
            OpenPGP::unarmor($pubkey, 'PGP PUBLIC KEY BLOCK')
        );

        $data = new OpenPGP_LiteralDataPacket($message);
        $encrypted = OpenPGP_Crypt_Symmetric::encrypt(
                $key,
                new OpenPGP_Message(array($data))
        );

      $armored=  OpenPGP::enarmor($encrypted->to_bytes(),'PGP MESSAGE');
      echo $armored;

from openpgp-php.

singpolyma avatar singpolyma commented on August 14, 2024

At a glance, your code looks like the right idea to me. Do you get an error from your decrypt attempt, or just no data?

from openpgp-php.

lukaisailovic avatar lukaisailovic commented on August 14, 2024

Well I'm trying to have some data encrypted for users for decrypt on their computes. When I try to decrypt it I'm just getting No data in gpg4usb and kleopatra could not determine the type. So no idea what is going on here

from openpgp-php.

singpolyma avatar singpolyma commented on August 14, 2024

so are you getting errors? Could you screenshot the error?

from openpgp-php.

lukaisailovic avatar lukaisailovic commented on August 14, 2024

Okay, I've used multiple clients now and these are messages I'm getting when trying to decrypt message with each one of them: (every client have my private key imported):
pgp4usb - No data error https://image.prntscr.com/image/_e9N6VrJRfirdKqzocIvXQ.png
kleopatra - https://image.prntscr.com/image/L2iacnFsRQmRtLPji4PYPg.png

from openpgp-php.

singpolyma avatar singpolyma commented on August 14, 2024

Could you also paste the output you tried to feed these programs for decryption?

from openpgp-php.

lukaisailovic avatar lukaisailovic commented on August 14, 2024

Fixed it. It was a spacing problem. When you just echo output it does not create right spacing. You have to put it in something like textarea

from openpgp-php.

OxMarco avatar OxMarco commented on August 14, 2024

I'm using the exact same code but can't decrypt it, plus every time I run it a totally different message is generated (the resulting messages have different character sequences).

        $key = OpenPGP_Message::parse(
            OpenPGP::unarmor($pubkey, 'PGP PUBLIC KEY BLOCK')
        );
        $message = 'Hello World';
        $data = new OpenPGP_LiteralDataPacket($message);
        $encrypted = OpenPGP_Crypt_Symmetric::encrypt(
                $key,
                new OpenPGP_Message(array($data))
        );

        $armored = OpenPGP::enarmor($encrypted->to_bytes(),'PGP MESSAGE');
        echo $armored;

from openpgp-php.

singpolyma avatar singpolyma commented on August 14, 2024

A different encrypted output every time is expected, since there are usually timestamps etc.

If you get an error trying to decrypt something made with that code, what error do you get?

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.