Gpg Generate Key Non Interactive

  1. Gpg Generate Key Non Interactive App
  2. Gpg Generate Key Non Interactive Free
  3. Gpg Generate Public Key

I am going to add a feature in my own version of SSPKS to sign Synology packages. But to do this, I need a way to create GPG key from a non-interactive script. Click to Read More.

This tutorial series will teach you how to use GPG in Linux terminal. I will not tell you a bunch of theory to overwhelm you. Instead, I show you quick and dirty examples to get you started, and explain the basic theory along the way.

This is part 1 of this series. At the end of this post, you should be able to generate your own public/private keypair and a revocation certificate. This certificate is used to revoke your public/private keypair when your private key is compromised or you forget the passphrase for your private key.

GPG can be used for encryption and for signing. This software is pre-installed on most Linux distributions. Currently the stable version is GPG 2.0. I’m using the modern version GPG 2.2 on Arch Linux.

  • Creating gpg keys non-interactively. GitHub Gist: instantly share code, notes, and snippets.
  • May 26, 2017  At this point, gpg will generate the keys using entropy. Entropy describes the amount of unpredictability and nondeterminism that exists in a system. GPG needs this entropy to generate a secure set of keys. This process may take a long time depending on how active your system is.
  • Mar 14, 2016  This video goes over how to generate either a PGP 9, or NAI7 key pair within FTP Manager. The video also covers the public PGP key export process, to provide a vendor with your key.

Check Your GPG Version

First Let’s check out the version of GPG on your system and some interesting tidbits. Run the following command.


As you can see, I’m using GPG 2.2.8, which is the latest version. We also know that the configuration directory is ~/.gnupg, which will hold our public/private key files. The default option file is ~/.gnupg/gpg.conf and ~/.gnupg/dirmngr.conf. It also tells us what algorithms are supported.

If you look closely, you can see that the insecure hash algorithm SHA1 is still supported in version 2.2.8 SHA1 is obsolete and you don’t want to use it to generate signature.

Create Your Public/Private Key Pair and Revocation Certificate

Use gpg --full-gen-key command to generate your key pair.

It asks you what kind of key you want. Notice there’re four options. The default is to create a RSA public/private key pair and also a RSA signing key. Let’s hit Enter to select the default.

Next it asks you the key length. The default is 2048 bits long. 1024 RSA key is obsolete. The longer 4096 RSA key will not provide more security than 2048 RSA key. So hit Enter to select the default.

After that it asks you how long the key should be valid, 2 years is fine. You can always update the expiration time later on.

Now it asks you if it’s correct. Notice that the default is No. So press y then Enter to confirm it’s correct.

And now we need to provide some user identification information for the key. This is important because this information will be included in our key. It’s one way of indicating who is owner of this key. The email address is a unique identifier for a person. You can leave Comment blank.

Select Okay.

Now it asks you to enter a passphrase to protect your private key. Enter a good and long passphrase and remember it. Because if you forget this passphrase, you won’t be able to unlock you private key.

Once you enter and confirm your passphrase. GPG will generate your keys.

It will take a while for GPG to generate your keys. So you can now do other stuff.

It took about 4 minutes on my system to generate my key pair.

This first line tells us that GPG created a unique identifier for public key. This unique identifier is in hex format. When someone wants to download you public key, they can refer to you public key via your email address or this hex value.

The third line tells us that GPG created a revocation certificate and its directory.Your should never share you private key with anyone.If you private key is compromised, you can use revocateion certificate to revoke your key. That means you tell the rest of the world that the old public key shall not be used any more.I suggest that you open this revocation certificate with your text editor to see what’s inside there.

Let’s look at the last three lines. They tell us the public key is 2048 bits using RSA algorithm. The public key ID 4F0BDACC matchs the last 8 bits of key fingerprint. The key fingerprint is a hash of your public key.

It also lists our user ID information: your name and your email address. And it also indicates the subkey which is 2048 bits using RSA algorithm and the unique identifier of the subkey.

Now you can find that there are two files created under ~/.gnupg/private-keys-v1.d/ directory. These two files are binary files with .key extension.

Export Your Public Key

Others need your public key to send encrypted message to you and only your private key can decrypt it. Use the following command to export your public key. --armor option means that the output is ASCII armored. The default is to create the binary OpenPGP format. user-id is your email address.

The exported public key is written to pubkey.asc file.

Export Your Private Key

Issue the following command to export your private key.

The exported key is written to privkey.asc file.

Protect Your Private Key and Revocation Certificate

Your private key should be kept in a safe place, like an encrypted flash drive. Treat it like your house key. Only you can have it and don’t lose it. And you must remember your passphrase, otherwise you can’t unlock your private key.

You should also protect your revocation certificate. If others have your revocation certificate, they can immediately revoke your public/private keypair and generate a fake public/priavte keypair.

In part 2 we will look at how to encrypt message with your public key and how to decrypt it with your private key. Take care!

[Total: 6 Average: 4.7]

Old Man Page

This is a very old version of the gpg man page. Generator mechanic training. Please see the latestrelease or software package for your operating system to find an up todate version ('man gpg2').

gpg

Name

Synopsis

DESCRIPTION

gpg is the main program for the GnuPG system.

This man page does only list the commands and options available. For amore verbose documentation get the GNU Privacy Handbook (GPH), which isavailable at https://www.gnupg.org/gph/ . You will find a list of HOWTOdocuments at https://www.gnupg.org/docs.html .

COMMANDS

gpg recognizes these commands:

-s, --sign

Make a signature. This command may be combined with--encrypt.

--clearsign

Make a clear text signature.

-b, --detach-sign

Make a detached signature.

-e, --encrypt

Encrypt data. This option may be combined with--sign.

-c, --symmetric

Encrypt with symmetric cipher only This commandasks for a passphrase.

--store

Store only (make a simple RFC1991 packet).

--decrypt [ file ]

Decrypt file (or stdin if no file isspecified) and write it to stdout (or the file specified with--output). If the decrypted file is signed, the signature is alsoverified. This command differs from the default operation, as itnever writes to the filename which is included in the file and itrejects files which don't begin with an encrypted message.

--verify [[ sigfile ] [ signed-files ]]

Assume that sigfile is asignature and verify it without generating any output. With noarguments, the signature packet is read from stdin (it may be adetached signature when not used in batch mode). If only a sigfile isgiven, it may be a complete signature or a detached signature, inwhich case the signed stuff is expected in a file without the '.sig'or '.asc' extension (if such a file does not exist it is expected atstdin; use a single dash ('-') as filename to force a read fromstdin). With more than 1 argument, the first should be a detachedsignature and the remaining files are the signed stuff.

--verify-files [ files ]

This is a special version of the --verifycommand which does not work with detached signatures. The commandexpects the files to bee verified either on the commandline or readsthe filenames from stdin; each anem muts be on separate line. Thecommand is intended for quick checking of many files.

--list-keys [ names ], --list-public-keys [ names ]

List all keysfrom the public keyrings, or just the ones given on the command line.

--list-secret-keys [ names ]

List all keys from the secretkeyrings, or just the ones given on the command line.

--list-sigs [ names ]

Same as --list-keys, but the signatures arelisted too.

--check-sigs [ names ]

Same as --list-sigs, but the signatures areverified.

--fingerprint [ names ]

List all keys with their fingerprints.This is the same output as --list-keys but with the additional outputof a line with the fingerprint. May also be combined with --list-sigsor --check-sigs. If this command is given twice, the fingerprints ofall secondary keys are listed too.

--list-packets

List only the sequence of packets. This is mainlyuseful for debugging.

--gen-key

Generate a new key pair. This command is normally onlyused interactive.

There is an experimental feature which allows to create keys in batchmode. See the file doc/DETAILS in the source distribution on how touse this.

--edit-key name

Present a menu which enables you to do all keyrelated tasks:

sign
Make a signature on key of user name If the key is notyet signed by the default user (or the users given with -u), theprogram displays the information of the key again, together withits fingerprint and asks whether it should be signed. Thisquestion is repeated for all users specified with -u.
lsign
Same as --sign but the signature is marked asnon-exportable and will therefore never be used by others. Thismay be used to make keys valid only in the local environment.
revsig
Revoke a signature. GnuPG asks for every signature whichhas been done by one of the secret keys, whether a revocationcertificate should be generated.
trust
Change the owner trust value. This updates the trust-dbimmediately and no save is required.
disable, enable
Disable or enable an entire key. A disabled keycan normally not be used for encryption.
adduid
Create an alternate user id.
deluid
Delete an user id.
addkey
Add a subkey to this key.
delkey
Remove a subkey.
revkey
Revoke a subkey.
expire
Change the key expiration time. If a key is selected,the time of this key will be changed. With no selection the keyexpiration of the primary key is changed.
passwd
Change the passphrase of the secret key.
uid n
Toggle selection of user id with index n. Use 0 todeselect all.
key n
Toggle selection of subkey with index n. Use 0 todeselect all.
check
Check all selected user ids.
pref
List preferences.
toggle
Toggle between public and secret key listing.
save
Save all changes to the key rings and quit.
quit
Quit the program without updating the key rings.

The listing shows you the key with its secondary keys and all userids. Selected keys or user ids are indicated by an asterisk. Thetrust value is displayed with the primary key: the first is theassigned owner trust and the second is the calculated trust value.Letters are used for the values:

-
No ownertrust assigned / not yet calculated.
e
Trust calculation has failed.
q
Not enough information for calculation.
n
Never trust this key.
m
Marginally trusted.
f
Fully trusted.
u
Ultimately trusted.
--sign-key name

Sign a public key with you secret key. This is ashortcut version of the subcommand 'sign' from --edit.

--lsign-key name

Sign a public key with you secret key but markit as non-exportable. This is a shortcut version of the subcommand'lsign' from --edit.

--trusted-key long key ID

Assume that the specified key (whichmust be given as a full 8 byte key ID) is as trustworthy as one ofyour own secret keys. This option is useful if you don't want to keepyour secret keys (or one of them) online but still be able to checkthe validity of a given recipient's or signator's key.

--delete-key name

Remove key from the public keyring

--delete-secret-key name

Remove key from the secret and publickeyring

--gen-revoke

Generate a revocation certificate for the completekey. To revoke a subkey or a signature, use the --edit command.

--export [ names ]

Either export all keys from all keyrings(default keyrings and those registered via option --keyring), or ifat least one name is given, those of the given name. The new keyringis written to stdout or to the file given with option 'output'. Usetogether with --armor to mail those keys.

--send-keys [ names ]

Same as --export but sends the keys to akeyserver. Option --keyserver must be used to give the name of thiskeyserver. Don't send your complete keyring to a keyserver - selectonly those keys which are new or changed by you.

--export-all [ names ]

Same as --export, but does also export keyswhich are not compatible to OpenPGP.

(no term)

--export-secret-keys [ names ], --export-secret-subkeys[ names ] :: Same as --export, but does export the secret keys. Thisis normally not very useful and a security risk. the second form ofthe command has the special property to render the secret part of theprimary key useless; this is a GNU extension to OpenPGP and otherimplementations can not be expected to successful import such a key.

--import [ files ], --fast-import [ files ]

Import/merge keys.This adds the given keys to the keyring. The fast version does notbuild the trustdb; this can be done at any time with the command--update-trustdb.

There are a few other options which control how this command works.Most notable here is the --merge-only options which does not insertnew keys but does only the merging of new signatures, user-IDs andsubkeys.

--recv-keys key IDs

Import the keys with the given key IDs froma HKP keyserver. Option --keyserver must be used to give the name ofthis keyserver.

--export-ownertrust

List the assigned ownertrust values in ASCIIformat for backup purposes

--import-ownertrust [ files ]

Update the trustdb with theownertrust values stored in files (or stdin if not given); existingvalues will be overwritten.

--print-md algo [ files ]

Print message digest of algorithm ALGOfor all given files of stdin. If '*' is used for the algorithm,digests for all available algorithms are printed.

--gen-random 0 1 2 [ count ]

Emit COUNT random bytes of thegiven quality level. If count is not given or zero, an endlesssequence of random bytes will be emitted. PLEASE, don't use thiscommand unless you know what you are doing, it may remove preciousentropy from the system!

--gen-prime modebits [ qbits ]

Use the source, Luke :-). Theoutput format is still subject to change.

--version

Print version information along with a list of supportedalgorithms.

--warranty

Print warranty information.

-h, --help

Print usage information. This is a really long listeven it does list not all options.

OPTIONS

Long options can be put in an options file (default '~/.gnupg/options').Do not write the 2 dashes, but simply the name of the option and anyrequired arguments. Lines with a hash as the first non-white-spacecharacter are ignored. Commands may be put in this file too, but thatdoes not make sense.

gpg recognizes these options:

-a, --armor

Create ASCII armored output.

-o, --output file

Write output to file.

-u, --local-user name

Use name as the user ID to sign. Thisoption is silently ignored for the list commands, so that it can beused in an options file.

--default-key name

Use name as default user ID for signatures.If this is not used the default user ID is the first user ID found inthe secret keyring.

-r, --recipient name,

Encrypt for user id name. If thisoption is not specified, GnuPG asks for the user-id unless--default-recipient is given

--default-recipient name

Use name as default recipient ifoption --recipient is not used and don't ask if this is a valid one.name must be a non empty.

--default-recipient-self

Use the default key as default recipientif option --recipient is not used and don't ask if this is a validone. The default key is the first one from the secret keyring or theone set with --default-key.

--no-default-recipient

Reset --default-recipient and--default-recipient-self.

--encrypt-to name

Same as --recipient but this one is intendedfor in the options file and may be used together with an own user-idas an 'encrypt-to-self'. These keys are only used when there areother recipients given either by use of --recipient or by the askeduser id. No trust checking is performed for these user ids and evendisabled keys can be used.

--no-encrypt-to

Disable the use of all --encrypt-to keys.

-v, --verbose

Give more information during processing. If usedtwice, the input data is listed in detail.

-q, --quiet

Try to be as quiet as possible.

-z n

Set compression level to n. A value of 0 for n disablescompression. Default is to use the default compression level of zlib(normally 6).

-t, --textmode

Use canonical text mode. If -t (but not --textmode)is used together with armoring and signing, this enables clearsignedmessages. This kludge is needed for PGP compatibility; normally youwould use --sign or --clearsign to selected the type of thesignature.

-n, --dry-run

Don't make any changes (this is not completelyimplemented).

-i, --interactive

Prompt before overwriting any files.

--batch

Use batch mode. Never ask, do not allow interactivecommands.

--no-tty

Make sure that the TTY (terminal) is never used for anyoutput. This option is needed in some cases because GnuPG sometimesprints warnings to the TTY if if --batch is used.

--no-batch

Disable batch mode. This may be of use if --batch isenabled from an options file.

--yes

Assume 'yes' on most questions.

--no

Assume 'no' on most questions.

--always-trust

Skip key validation and assume that used keys arealways fully trusted. You won't use this unless you have installedsome external validation scheme.

--keyserver name

Use name to lookup keys which are not yet inyour keyring. This is only done while verifying messages withsignatures. The option is also required for the command --send-keysto specify the keyserver to where the keys should be send. Allkeyservers synchronize with each other - so there is no need to sendkeys to more than one server. Using the command 'host -l pgp.net grep wwwkeys' gives you a list of keyservers. Because there is loadbalancing using round-robin DNS you may notice that you get differentkey servers.

--no-auto-key-retrieve

This option disables the automaticretrieving of keys from a keyserver while verifying signatures. Thisoption allows to keep a keyserver in the options file or the--send-keys and --recv-keys commands.

--honor-http-proxy

Try to access the keyserver over the proxy setwith the variable 'httpproxy'.

--keyring file

Add file to the list of keyrings. If filebegins with a tilde and a slash, these are replaced by the HOMEdirectory. If the filename does not contain a slash, it is assumed tobe in the home-directory ('~/.gnupg' if --homedir is not used). Thefilename may be prefixed with a scheme:

'gnupg-ring:' is the default one.

'gnupg-gdbm:' may be used for a GDBM ring. Note that GDBM isexperimental and likely to be removed in future versions.

It might make sense to use it together with --no-default-keyring.

--secret-keyring file

Same as --keyring but for the secretkeyrings.

--homedir directory

Set the name of the home directory todirectory If this option is not used it defaults to '~/.gnupg'. Itdoes not make sense to use this in a options file. This alsooverrides the environment variable 'GNUPGHOME'.

How to create a HashMap with two keys (Key-Pair, Value)? Ask Question. Key of a HashMap is a pair of integers. How to convert and store it? Generate only unique combinations when input contains duplicates more hot questions Question feed Subscribe to RSS. Generate keys for hashmap c classes for integers 2. Basic HashMap Operations. How to iterate through HashMap? How to copy Map content to another HashMap? How to search a key in HashMap? How to search a value in HashMap? How to get all keys from HashMap? How to get entry set from HashMap? How to delete all elements from HashMap? How to eliminate duplicate user defined objects as a key from HashMap? Feb 07, 2016  HashMap and TreeMap are part of collection framework. HashMap java.util.HashMap class is a Hashing based implementation. In HashMap, we have a key and a value pair. HashMap hmap = new HashMap; Let us consider below example where we have to count occurrences of each integer in given array of integers. Hello, I have HashMap, with 100 numbers inside (1-100 range) where this number is key, and every has its default value which is 0. Now I'm wondering how can I get for example object from this map, lets say with key 1 and its value? So it would change from 0 to 1 in this case. Apr 24, 2018  Take a look at a couple of gotchas (and their solutions) when it comes to using custom classes as keys with your HashMaps.

--charset name

Set the name of the native character set. This isused to convert some strings to proper UTF-8 encoding. Valid valuesfor name are:

iso-8859-1
This is the default Latin 1 set.
iso-8859-2
The Latin 2 set.
koi8-r
The usual Russian set (rfc1489).
--utf8-strings, --no-utf8-strings

Assume that the arguments arealready given as UTF8 strings. The default (--no-utf8-strings) is toassume that arguments are encoded in the character set as specifiedby --charset. These options effects all following arguments. Bothoptions may used multiple times.

--options file

Read options from file and do not try to readthem from the default options file in the homedir (see --homedir).This option is ignored if used in an options file.

--no-options

Shortcut for '--options /dev/null'. This option isdetected before an attempt to open an option file.

--load-extension name

Load an extension module. If name doesnot contain a slash it is searched in '/usr/local/lib/gnupg' See themanual for more information about extensions.

--debug flags

Set debugging flags. All flags are or-ed andflags may be given in C syntax (e.g. 0x0042).

--debug-all

Set all useful debugging flags.

--status-fd n

Write special status strings to the filedescriptor n. See the file DETAILS in the documentation for alisting of them.

--logger-fd n

Write log output to file descriptor n and not tostderr.

--no-comment

Do not write comment packets. This option affectsonly the generation of secret keys. Please note, that this hasnothing to do with the comments in clear text signatures.

--comment string

Use string as comment string in clear textsignatures. To suppress those comment strings entirely, use an emptystring here.

--default-comment

Force to write the standard comment string inclear text signatures. Use this to overwrite a --comment from aconfig file.

--no-version

Omit the version string in clear text signatures.

--emit-version

Force to write the version string in clear textsignatures. Use this to overwrite a previous --no-version from aconfig file.

-N, --notation-data name=value

Put the name value pair into thesignature as notation data. name must consists only of alphanumericcharacters, digits or the underscore; the first character must not bea digit. value may be any printable string; it will encoded inUTF8, so sou should have check that your --charset is set right. Ifyou prefix name with an exclamation mark, the notation data will beflagged as critical (rfc2440:5.2.3.15).

--set-policy-url string

Use string as Policy URL forsignatures (rfc2440:5.2.3.19). If you prefix it with an exclamationmark, the policy URL packet will be flagged as critical.

--set-filename string

Use string as the name of file which isstored in messages.

--use-embedded-filename

Try to create a file with a name asembedded in the data. This can be a dangerous option as it allows tooverwrite files.

--completes-needed n

Number of completely trusted users tointroduce a new key signer (defaults to 1).

--marginals-needed n
Gpg Generate Key Non Interactive

Number of marginally trusted users tointroduce a new key signer (defaults to 3)

--max-cert-depth n

Maximum depth of a certification chain(default is 5).

--cipher-algo name

Use name as cipher algorithm. Running theprogram with the command --version yields a list of supportedalgorithms. If this is not used the cipher algorithm is selected fromthe preferences stored with the key.

--digest-algo name

Use name as message digest algorithm.Running the program with the command --version yields a list ofsupported algorithms. Please note that using this option may violatethe OpenPGP requirement, that a 160 bit hash is to be used for DSA.

--s2k-cipher-algo name

Use name as the cipher algorithm usedto protect secret keys. The default cipher is BLOWFISH. This cipheris also used for conventional encryption if --cipher-algo is notgiven.

--s2k-digest-algo name

Use name as the digest algorithm usedto mangle the passphrases. The default algorithm is RIPE-MD-160. Thisdigest algorithm is also used for conventional encryption if--digest-algo is not given.

--s2k-mode n

Selects how passphrases are mangled. If n is 0 aplain passphrase (which is not recommended) will be used, a 1(default) adds a salt to the passphrase and a 3 iterates the wholeprocess a couple of times. Unless --rfc1991 is used, this mode isalso used for conventional encryption.

--compress-algo n

Use compress algorithm n. Default is 2 whichis RFC1950 compression. You may use 1 to use the old zlib version(RFC1951) which is used by PGP. The default algorithm may give betterresults because the window size is not limited to 8K. If this is notused the OpenPGP behavior is used, i.e. the compression algorithm isselected from the preferences; note, that this can't be done if youdo not encrypt the data.

--disable-cipher-algo name

Never allow the use of name ascipher algorithm. The given name will not be checked so that a laterloaded algorithm will still get disabled.

--disable-pubkey-algo name

Never allow the use of name aspublic key algorithm. The given name will not be checked so that alater loaded algorithm will still get disabled.

--throw-keyid
Gpg Generate Key Non Interactive

Do not put the keyid into encrypted packets. Thisoption hides the receiver of the message and is a countermeasureagainst traffic analysis. It may slow down the decryption processbecause all available secret keys are tried.

--not-dash-escaped

This option changes the behavior of cleartextsignatures so that they can be used for patch files. You should notsend such an armored file via email because all spaces and lineendings are hashed too. You can not use this option for data whichhas 5 dashes at the beginning of a line, patch files don't have this.A special armor header line tells GnuPG about this cleartextsignature option.

--escape-from-lines

Because some mailers change lines startingwith 'From ' to '<From ' it is good to handle such lines in a specialway when creating cleartext signatures. All other PGP versions do itthis way too. This option is not enabled by default because it wouldviolate rfc2440.

--passphrase-fd n

Read the passphrase from file descriptor n.If you use 0 for n, the passphrase will be read from stdin. Thiscan only be used if only one passphrase is supplied. Don't use thisoption if you can avoid it.

--command-fd n

This is a replacement for the depreciatedshared-memory IPC mode. If this option is enabled, user input onquestions is not expected from the TTY but from the given filedescriptor. It should be used together with --status-fd. See the filedoc/DETAILS in the source distribution for details on how to use it.

--rfc1991

Try to be more RFC1991 (PGP 2.x) compliant.

--openpgp

Reset all packet, cipher and digest options to OpenPGPbehavior. Use this option to reset all previous options like--rfc1991, --force-v3-sigs, --s2k-*, --cipher-algo, --digest-algo and--compress-algo to OpenPGP compliant values. All PGP workarounds arealso disabled.

--force-v3-sigs

OpenPGP states that an implementation shouldgenerate v4 signatures but PGP 5.x recognizes v4 signatures only onkey material. This options forces v3 signatures for signatures ondata.

--force-mdc

Force the use of encryption with appended manipulationcode. This is always used with the newer cipher (those with ablocksize greater than 64 bit). This option might not be implementedyet.

--allow-non-selfsigned-uid

Allow the import of keys with user IDswhich are not self-signed. This is only allows the import - keyvalidation will fail and you have to check the validity of the key myother means. This hack is needed for some German keys generated withpgp 2.6.3in. You should really avoid using it, because OpenPGP hasbetter mechanics to do separate signing and encryption keys.

--allow-freeform-uid

Disable all checks on the form of the user IDwhile generating a new one. This option should only be used in veryspecial environments as it does not ensure the de-facto standardformat of user IDs.

--ignore-time-conflict

GnuPG normally checks that the timestampsassociated with keys and signatures have plausible values. However,sometimes a signature seems to be older than the key due to clockproblems. This option makes these checks just a warning.

--lock-once

Lock the databases the first time a lock is requestedand do not release the lock until the process terminates.

--lock-multiple

Release the locks every time a lock is no longerneeded. Use this to override a previous --lock-once from a configfile.

--lock-never

Disable locking entirely. This option should be usedonly in very special environments, where it can be assured that onlyone process is accessing those files. A bootable floppy with astandalone encryption system will probably use this. Improper usageof this option may lead to data and key corruption.

--no-random-seed-file

GnuPG uses a file to store it's internalrandom pool over invocations. This makes random generation faster;however sometimes write operations are not desired. This option canbe used to achive that with the cost of slower random generation.

--no-verbose

Reset verbose level to 0.

--no-greeting

Suppress the initial copyright message but do notenter batch mode.

--no-secmem-warning

Suppress the warning about 'using insecurememory'.

--no-armor

Assume the input data is not in ASCII armored format.

--no-default-keyring

Do not add the default keyrings to the listof keyrings.

--skip-verify

Skip the signature verification step. This may beused to make the decryption faster if the signature verification isnot needed.

--with-colons

Print key listings delimited by colons.

--with-key-data

Print key listings delimited by colons and printthe public key data.

--with-fingerprint

Same as the command --fingerprint but changesonly the format of the output and may be used together with anothercommand.

--fast-list-mode

Changes the output of the list commands to workfaster; this is achieved by leaving some parts empty. Someapplications don't need the user ID and the trust information givenin the listings. By using this options they can get a faster listing.The excact behaviour of this option may change in future versions.

--list-only

Changes the behaviour of some commands. This is like--dry-run but different in some cases. The semantic of this commandmay be extended in the future. Currently it does only skip the actualdecryption pass and therefore enables a fast listing of theencryption keys.

--no-literal

This is not for normal use. Use the source to see forwhat it might be useful.

--set-filesize

This is not for normal use. Use the source to seefor what it might be useful.

--emulate-md-encode-bug

GnuPG versions prior to 1.0.2 had a bug inthe way a signature was encode. This options enables a workaround bychecking faulty signatures again with the encoding used in oldversions. This may only happen for ElGamal signatures which are notwidely used.

--show-session-key

Display the session key used for one message.See --override-session-key for the counterpart of this option.

We think that Key-Escrow is a Bad Thing; however the user should havethe freedom to decide whether to go to prison or to reveal thecontent of one specific message without compromising all messagesever encrypted for one secret key. DON'T USE IT UNLESS YOU ARE REALLYFORCED TO DO SO.

--override-session-key string

Don't use the public key but thesession key string. The format of this string is the same as theone printed by --show-session-key. This option is normally not usedbut comes handy in case someone forces you to reveal the content ofan encrypted message; using this option you can do this withouthanding out the secret key.

--merge-only

Don't insert new keys into the keyrings while doingan import.

--try-all-secrets

Don't look at the key ID as stored in themessage but try all secret keys in turn to find the right decryptionkey. This option forces the behaviour as used by anonymous recipients(created by using --throw-keyid) and might come handy in case wherean encrypted message contains a bogus key ID.

How to specify a user ID

There are different ways on how to specify a user ID to GnuPG; here aresome examples:

  • :: Used to locate the default home directory.
  • Here the key ID isgiven in the usual short form.
  • 234AABBCC34567C4, 0F323456784E56EAB, 01AB3FED1347A5612,0x234AABBCC34567C4 :: Here the key ID is given in the long form asused by OpenPGP.
  • 1234343434343434C434343434343434,123434343434343C3434343434343734349A3434,0E12343434343434343434EAB3484343434343434,0xE12343434343434343434EAB3484343434343434 :: The best way to specifya key ID is by using the fingerprint of the key. This avoids anyambiguities in case that there are duplicated key IDs (which arereally rare for the long key IDs).
  • Using an exact tomatch string. The equal sign indicates this.
  • Using the email address part whichmust match exactly. The left angle bracket indicates this emailaddress mode.
  • All words must match exactly (not casesensitive) but can appear in any order in the user ID. Words are anysequences of letters, digits, the underscore and all characters withbit 7 set.
  • Using the Local ID. This is a very low level method and shouldonly be used by applications which really need it. The hash characterindicates this method. An application should not assume that this isonly a number.
  • By case insensitive substring matching. This is thedefault mode but applications may want to explicitely indicate thisby putting the asterisk in front.

RETURN VALUE

The program returns 0 if everything was fine, 1 if at least a signaturewas bad, and other error codes for fatal errors.

EXAMPLES

gpg -se -r Bobfile
sign and encrypt for user Bob
gpg --clearsign file
make a clear text signature
gpg -sb file
make a detached signature
gpg --list-keys user_ID
show keys
gpg --fingerprint user_ID
show fingerprint
gpg --verify pgpfile, gpg --verify sigfile [ files ]
Verifythe signature of the file but do not output the data. The second formis used for detached signatures, where sigfile is the detachedsignature (either ASCII armored of binary) and [ files ] are thesigned data; if this is not given the name of the file holding thesigned data is constructed by cutting off the extension ('.asc' or'.sig') of sigfile or by asking the user for the filename.

ENVIRONMENT

HOME
Used to locate the default home directory.
GNUPGHOME
If set directory used instead of '~/.gnupg'.
httpproxy
Only honored when the option --honor-http-proxy isset.

FILES

~/.gnupg/secring.gpg
The secret keyring
~/.gnupg/secring.gpg.lock
and the lock file
~/.gnupg/pubring.gpg
The public keyring
~/.gnupg/pubring.gpg.lock
and the lock file
~/.gnupg/trustdb.gpg
The trust database
~/.gnupg/trustdb.gpg.lock
and the lock file
~/.gnupg/randomseed
used to preserve the internal random pool
~/.gnupg/options
May contain options
/usr[/local]/share/gnupg/options.skel
Skeleton options file
usr[/local]/lib/gnupg
Default location for extensions

WARNINGS

Gpg Generate Key Non Interactive App

Use a good password for your user account and a good passphrase toprotect your secret key. This passphrase is the weakest part of thewhole system. Programs to do dictionary attacks on your secret keyringare very easy to write and so you should protect your '~/.gnupg/'directory very well.

Keep in mind that, if this program is used over a network (telnet), itis very easy to spy out your passphrase!

Gpg Generate Key Non Interactive Free

BUGS

Gpg Generate Public Key

On many systems this program should be installed as setuid(root). Thisis necessary to lock memory pages. Locking memory pages prevents theoperating system from writing memory pages to disk. If you get nowarning message about insecure memory 3our operating system supportslocking without being root. The program drops root privileges as soon aslocked memory is allocated.

Comments are closed.