Code Monkey home page Code Monkey logo

Comments (2)

isislovecruft avatar isislovecruft commented on June 30, 2024

@Hainish Oh... the docs shouldn't say that. Do you remember where in the docs you saw this?

The encrypt method can take multiple recipients, just not in a list. The first parameter should be the data to encrypt, and all the rest of the non-keyword parameters should be interpreted as *recipients:

Type:       instancemethod
String Form:<bound method GPG.encrypt of <gnupg.gnupg.GPG object at 0x7f424c1375d0>>
File:       ../python-gnupg/gnupg/gnupg.py
Definition: g.encrypt(self, data, *recipients, **kwargs)
Docstring:
Encrypt the message contained in ``data`` to ``recipients``.

:param str data: The file or bytestream to encrypt.

:param str recipients: The recipients to encrypt to. Recipients must
    be specified keyID/fingerprint. Care should be taken in Python2.x
    to make sure that the given fingerprint is in fact a string and
    not a unicode object.

:param str default_key: The keyID/fingerprint of the key to use for
    signing. If given, ``data`` will be encrypted and signed.

:param str passphrase: If given, and ``default_key`` is also given,
    use this passphrase to unlock the secret portion of the
    ``default_key`` to sign the encrypted ``data``. Otherwise, if
    ``default_key`` is not given, but ``symmetric=True``, then use
    this passphrase as the passphrase for symmetric
    encryption. Signing and symmetric encryption should *not* be
    combined when sending the ``data`` to other recipients, else the
    passphrase to the secret key would be shared with them.

:param bool armor: If True, ascii armor the output; otherwise, the
    output will be in binary format. (Default: True)

:param bool encrypt: If True, encrypt the ``data`` using the
    ``recipients`` public keys. (Default: True)

:param bool symmetric: If True, encrypt the ``data`` to ``recipients``
    using a symmetric key. See the ``passphrase`` parameter. Symmetric
    encryption and public key encryption can be used simultaneously,
    and will result in a ciphertext which is decryptable with either
    the symmetric ``passphrase`` or one of the corresponding private
    keys.

:param bool always_trust: If True, ignore trust warnings on recipient
    keys. If False, display trust warnings.  (default: True)

:param str output: The output file to write to. If not specified, the
    encrypted output is returned, and thus should be stored as an
    object in Python.

from python-gnupg.

isislovecruft avatar isislovecruft commented on June 30, 2024

Um… so either there was some confusion, or I had bad documentation that got fixed somewhere along the way, or there is actually some sort of problem here and I didn't understand what it was. But since this ticket has been open forever, no one else has complained about encrypt() not working for multiple recipients, and there are several unittests for encrypting to multiple recipients in all sorts of different ways, I am closing this ticket.

Please feel free to reopen if I've misunderstood something.

from python-gnupg.

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.