{
    "content": [
        {
            "type": "text",
            "text": "# GNUPG (man)\n\n## NAME\n\nGnuPG - Perl module interface to the GNU Privacy Guard (v1.x.x series)\n\n## SYNOPSIS\n\nuse GnuPG qw( :algo );\nmy $gpg = new GnuPG();\n$gpg->encrypt(  plaintext    => \"file.txt\",    output        => \"file.gpg\",\narmor    => 1,         sign    => 1,\npassphrase  => $secret );\n$gpg->decrypt( ciphertext    => \"file.gpg\",    output        => \"file.txt\" );\n$gpg->clearsign( plaintext => \"file.txt\", output => \"file.txt.asc\",\npassphrase => $secret,   armor => 1,\n);\n$gpg->verify( signature => \"file.txt.asc\", file => \"file.txt\" );\n$gpg->genkey( name => \"Joe Blow\",        comment => \"My GnuPG key\",\npassphrase => $secret,\n);\n\n## DESCRIPTION\n\nGnuPG is a perl interface to the GNU Privacy Guard. It uses the shared memory coprocess\ninterface that gpg provides for its wrappers. It tries its best to map the interactive\ninterface of the gpg to a more programmatic model.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **API OVERVIEW**\n- **CONSTRUCTOR** (1 subsections)\n- **METHODS** (5 subsections)\n- **BUGS AND LIMITATIONS**\n- **AUTHOR**\n- **COPYRIGHT**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "GNUPG",
        "section": "",
        "mode": "man",
        "summary": "GnuPG - Perl module interface to the GNU Privacy Guard (v1.x.x series)",
        "synopsis": "use GnuPG qw( :algo );\nmy $gpg = new GnuPG();\n$gpg->encrypt(  plaintext    => \"file.txt\",    output        => \"file.gpg\",\narmor    => 1,         sign    => 1,\npassphrase  => $secret );\n$gpg->decrypt( ciphertext    => \"file.gpg\",    output        => \"file.txt\" );\n$gpg->clearsign( plaintext => \"file.txt\", output => \"file.txt.asc\",\npassphrase => $secret,   armor => 1,\n);\n$gpg->verify( signature => \"file.txt.asc\", file => \"file.txt\" );\n$gpg->genkey( name => \"Joe Blow\",        comment => \"My GnuPG key\",\npassphrase => $secret,\n);",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [
            {
                "name": "gpg",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/gpg/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 20,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 4,
                "subsections": []
            },
            {
                "name": "API OVERVIEW",
                "lines": 12,
                "subsections": []
            },
            {
                "name": "CONSTRUCTOR",
                "lines": 1,
                "subsections": [
                    {
                        "name": "new ( [params] )",
                        "lines": 20
                    }
                ]
            },
            {
                "name": "METHODS",
                "lines": 69,
                "subsections": [
                    {
                        "name": "encrypt( [params] )",
                        "lines": 43
                    },
                    {
                        "name": "sign( [params] )",
                        "lines": 29
                    },
                    {
                        "name": "clearsign( [params] )",
                        "lines": 3
                    },
                    {
                        "name": "verify( [params] )",
                        "lines": 43
                    },
                    {
                        "name": "decrypt( [params] )",
                        "lines": 26
                    }
                ]
            },
            {
                "name": "BUGS AND LIMITATIONS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "AUTHOR",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "COPYRIGHT",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 9,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "GnuPG - Perl module interface to the GNU Privacy Guard (v1.x.x series)\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use GnuPG qw( :algo );\n\nmy $gpg = new GnuPG();\n\n$gpg->encrypt(  plaintext    => \"file.txt\",    output        => \"file.gpg\",\narmor    => 1,         sign    => 1,\npassphrase  => $secret );\n\n$gpg->decrypt( ciphertext    => \"file.gpg\",    output        => \"file.txt\" );\n\n$gpg->clearsign( plaintext => \"file.txt\", output => \"file.txt.asc\",\npassphrase => $secret,   armor => 1,\n);\n\n$gpg->verify( signature => \"file.txt.asc\", file => \"file.txt\" );\n\n$gpg->genkey( name => \"Joe Blow\",        comment => \"My GnuPG key\",\npassphrase => $secret,\n);\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "GnuPG is a perl interface to the GNU Privacy Guard. It uses the shared memory coprocess\ninterface that gpg provides for its wrappers. It tries its best to map the interactive\ninterface of the gpg to a more programmatic model.\n",
                "subsections": []
            },
            "API OVERVIEW": {
                "content": "The API is accessed through methods on a GnuPG object which is a wrapper around the gpg\nprogram.  All methods take their argument using named parameters, and errors are returned by\nthrowing an exception (using croak).  If you want to catch errors you will have to use eval.\n\nWhen handed in a file handle for input or output parameters on many of the functions, the API\nattempts to tie that handle to STDIN and STDOUT. In certain persistent environments\n(particularly a web environment), this will not work. This problem can be avoided by passing\nin file names to all relevant parameters rather than a Perl file handle.\n\nThere is also a tied file handle interface which you may find more convenient for encryption\nand decryption. See GnuPG::Tie(3) for details.\n",
                "subsections": []
            },
            "CONSTRUCTOR": {
                "content": "",
                "subsections": [
                    {
                        "name": "new ( [params] )",
                        "content": "You create a new GnuPG wrapper object by invoking its new method.  (How original !).  The\nmodule will try to finds the gpg program in your path and will croak if it can't find it.\nHere are the parameters that it accepts :\n\ngnupgpath\nPath to the gpg program.\n\noptions\nPath to the options file for gpg. If not specified, it will use the default one (usually\n~/.gnupg/options).\n\nhomedir\nPath to the gpg home directory. This is the directory that contains the default options\nfile, the public and private key rings as well as the trust database.\n\ntrace\nIf this variable is set to true, gpg debugging output will be sent to stderr.\n\nExample: my $gpg = new GnuPG();\n"
                    }
                ]
            },
            "METHODS": {
                "content": "genkey( [params] )\nThis methods is used to create a new gpg key pair. The methods croaks if there is an error.\nIt is a good idea to press random keys on the keyboard while running this methods because it\nconsumes a lot of entropy from the computer. Here are the parameters it accepts :\n\nalgo\nThis is the algorithm use to create the key. Can be DSAELGAMAL, DSA, RSARSA or RSA.  It\ndefaults to DSAELGAMAL. To import those constant in your name space, use the :algo tag.\n\nsize\nThe size of the public key. Defaults to 1024. Cannot be less than 768 bits, and keys\nlonger than 2048 are also discouraged. (You *DO* know that your monitor may be leaking\nsensitive information ;-).\n\nvalid\nHow long the key is valid. Defaults to 0 or never expire.\n\nname\nThis is the only mandatory argument. This is the name that will used to construct the\nuser id.\n\nemail\nOptional email portion of the user id.\n\ncomment\nOptional comment portion of the user id.\n\npassphrase\nThe passphrase that will be used to encrypt the private key. Optional but strongly\nrecommended.\n\nExample: $gpg->genkey( algo => DSAELGAMAL, size => 1024,\nname => \"My name\" );\n\nimportkeys( [params] )\nImport keys into the GnuPG private or public keyring. The method croaks if it encounters an\nerror. It returns the number of keys imported. Parameters :\n\nkeys\nOnly parameter and mandatory. It can either be a filename or a reference to an array\ncontaining a list of files that will be imported.\n\nExample: $gpg->importkeys( keys => [ qw( key.pub key.sec ) ] );\n\nexportkeys( [params] )\nExports keys from the GnuPG keyrings. The method croaks if it encounters an error. Parameters\n:\n\nkeys\nOptional argument that restricts the keys that will be exported.  Can either be a user id\nor a reference to an array of userid that specifies the keys to be exported. If left\nunspecified, all keys will be exported.\n\nsecret\nIf this argument is to true, the secret keys rather than the public ones will be\nexported.\n\nall If this argument is set to true, all keys (even those that aren't OpenPGP compliant) will\nbe exported.\n\noutput\nThis argument specifies where the keys will be exported. Can be either a file name or a\nreference to a file handle. If not specified, the keys will be exported to stdout.\n\narmor\nSet this parameter to true, if you want the exported keys to be ASCII armored.\n\nExample: $gpg->exportkeys( armor => 1, output => \"keyring.pub\" );\n",
                "subsections": [
                    {
                        "name": "encrypt( [params] )",
                        "content": "This method is used to encrypt a message, either using assymetric or symmetric cryptography.\nThe methods croaks if an error is encountered. Parameters:\n\nplaintext\nThis argument specifies what to encrypt. It can be either a filename or a reference to a\nfile handle. If left unspecified, STDIN will be encrypted.\n\noutput\nThis optional argument specifies where the ciphertext will be output.  It can be either a\nfile name or a reference to a file handle. If left unspecified, the ciphertext will be\nsent to STDOUT.\n\narmor\nIf this parameter is set to true, the ciphertext will be ASCII armored.\n\nsymmetric\nIf this parameter is set to true, symmetric cryptography will be used to encrypt the\nmessage. You will need to provide a passphrase parameter.\n\nrecipient\nIf not using symmetric cryptography, you will have to provide this parameter. It should\ncontains the userid of the intended recipient of the message. It will be used to look up\nthe key to use to encrypt the message. The parameter can also take an array ref, if you\nwant to encrypt the message for a group of recipients.\n\nsign\nIf this parameter is set to true, the message will also be signed. You will probably have\nto use the passphrase parameter to unlock the private key used to sign message. This\noption is incompatible with the symmetric one.\n\nlocal-user\nThis parameter is used to specified the private key that will be used to sign the\nmessage. If left unspecified, the default user will be used. This option only makes sense\nwhen using the sign option.\n\npassphrase\nThis parameter contains either the secret passphrase for the symmetric algorithm or the\npassphrase that should be used to decrypt the private key.\n\nExample: $gpg->encrypt( plaintext => file.txt, output => \"file.gpg\",\nsign => 1, passphrase => $secret\n);\n"
                    },
                    {
                        "name": "sign( [params] )",
                        "content": "This method is used create a signature for a file or stream of data.  This method croaks on\nerrors. Parameters :\n\nplaintext\nThis argument specifies what  to sign. It can be either a filename or a reference to a\nfile handle. If left unspecified, the data read on STDIN will be signed.\n\noutput\nThis optional argument specifies where the signature will be output.  It can be either a\nfile name or a reference to a file handle. If left unspecified, the signature will be\nsent to STDOUT.\n\narmor\nIf this parameter is set to true, the signature will be ASCII armored.\n\npassphrase\nThis parameter contains the secret that should be used to decrypt the private key.\n\nlocal-user\nThis parameter is used to specified the private key that will be used to make the\nsignature . If left unspecified, the default user will be used.\n\ndetach-sign\nIf set to true, a digest of the data will be signed rather than the whole file.\n\nExample: $gpg->sign( plaintext => \"file.txt\", output => \"file.txt.asc\",\narmor => 1,\n);\n"
                    },
                    {
                        "name": "clearsign( [params] )",
                        "content": "This methods clearsign a message. The output will contains the original message with a\nsignature appended. It takes the same parameters as the sign method.\n"
                    },
                    {
                        "name": "verify( [params] )",
                        "content": "This method verifies a signature against the signed message. The methods croaks if the\nsignature is invalid or an error is encountered. If the signature is valid, it returns an\nhash with the signature parameters. Here are the method's parameters :\n\nsignature\nIf the message and the signature are in the same file (i.e. a clearsigned message), this\nparameter can be either a file name or a reference to a file handle. If the signature\ndoesn't follows the message, than it must be the name of the file that contains the\nsignature.\n\nfile\nThis is a file name or a reference to an array of file names that contains the signed\ndata.\n\nWhen the signature is valid, here are the elements of the hash that is returned by the method\n:\n\nsigid\nThe signature id. This can be used to protect against replay attack.\n\ndate\nThe data at which the signature has been made.\n\ntimestamp\nThe epoch timestamp of the signature.\n\nkeyid\nThe key id used to make the signature.\n\nuser\nThe userid of the signer.\n\nfingerprint\nThe fingerprint of the signature.\n\ntrust\nThe trust value of the public key of the signer. Those are values that can be imported in\nyour namespace with the :trust tag. They are (TRUSTUNDEFINED, TRUSTNEVER,\nTRUSTMARGINAL, TRUSTFULLY, TRUSTULTIMATE).\n\nExample : my $sig = $gpg->verify( signature => \"file.txt.asc\",\nfile => \"file.txt\" );\n"
                    },
                    {
                        "name": "decrypt( [params] )",
                        "content": "This method decrypts an encrypted message. It croaks, if there is an error while decrypting\nthe message. If the message was signed, this method also verifies the signature. If\ndecryption is sucessful, the method either returns the valid signature parameters if present,\nor true. Method parameters :\n\nciphertext\nThis optional parameter contains either the name of the file containing the ciphertext or\na reference to a file handle containing the ciphertext. If not present, STDIN will be\ndecrypted.\n\noutput\nThis optional parameter determines where the plaintext will be stored.  It can be either\na file name or a reference to a file handle.  If left unspecified, the plaintext will be\nsent to STDOUT.\n\nsymmetric\nThis should be set to true, if the message is encrypted using symmetric cryptography.\n\npassphrase\nThe passphrase that should be used to decrypt the message (in the case of a message\nencrypted using a symmetric cipher) or the secret that will unlock the private key that\nshould be used to decrypt the message.\n\nExample: $gpg->decrypt( ciphertext => \"file.gpg\", output => \"file.txt\"\npassphrase => $secret );\n"
                    }
                ]
            },
            "BUGS AND LIMITATIONS": {
                "content": "This module doesn't work (yet) with the v2 branch of GnuPG.\n",
                "subsections": []
            },
            "AUTHOR": {
                "content": "Francis J. Lacoste <francis.lacoste@Contre.COM>\n",
                "subsections": []
            },
            "COPYRIGHT": {
                "content": "Copyright (c) 1999,2000 iNsu Innovations. Inc.  Copyright (c) 2001 Francis J. Lacoste\n\nThis program is free software; you can redistribute it and/or modify it under the terms of\nthe GNU General Public License as published by the Free Software Foundation; either version 2\nof the License, or (at your option) any later version.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "GnuPG::Tie\n\nAlternative module: GnuPG::Interface\n\ngpg(1)\n\n\n\nperl v5.26.0                                 2017-01-21                                   GnuPG(3pm)",
                "subsections": []
            }
        }
    }
}