1. Gpg4win Command Line Generate Key Codes
  2. Gpg4win Command Line Generate Key Code
  3. Gpg4win Command Line Generate Key Download
7 Creating a certificateContents

Now that you have found out why GnuPG is so secure(Chapter 3), and how a good passphraseprovides protection for your private key (Chapter 4),you are now ready to create your own key pair .

We use cookies and similar technologies to give you a better experience, improve performance, analyze traffic, and to personalize content. By continuing to browse this website you agree to the use of cookies.

As we saw in Chapter 3, a key pair consists ofa public and a private key. With the addition of ane-mail address, login name etc., which youenter when creating the pair (so-called meta data), you can obtainyour private certificate with the public and private key.

This definition applies to both OpenPGP as well as S/MIME (S/MIMEcertificates correspond with a standard described as'X.509').


It would be nice if I could practice this importantstep of creating a key pair ....

Not to worry, you can do just that - but only with OpenPGP:

If you decide for the OpenPGP method of authentication, the 'Web of Trust', then you can practice theentire process for creating a key pair, encryption and decryption asoften as you like, until you feel very comfortable.

This 'dry run' will strengtthen your trust in Gpg4win, and the 'hotphase' of OpenPGP key pair creation will no longer be a problem foryou.

Your partner in this exercise is Adele . Adele is a testservice which is still derived from the GnuPP predecessorproject and is still in operation. In this compendium wecontinue to recommend the use of this practice robot. We would alsolike to thank the owners of gnupp.de for operating this practicerobot.

Using Adele, you can practice and test the OpenPGP key pairwhich you will be creating shortly, before you start using it in earnest.But more on that later.

Let's go!Open Kleopatra using the Windows start menu:

You will see the main Kleopatra screen -the certificate administration:

At the beginning, this overview will be empty, since you have notcreated or imported any certificates yet.

Click on File -> New Certificate.

In the following dialog you select the format for the certificate. Youcan choose from the following: OpenPGP (PGP/MIME)or X.509 (S/MIME).

The differences and common features of the two formats have already beendiscussed in Chapter 5.


This chapter of the compendium breaks off into twosections for each method at this point. Information is then combinedat the end of the Chapter.

Depending on whether you chose OpenPGP or X.509 (S/MIME), you can nowread either:

  • Section 7.1:Creating an OpenPGP certificate page) or
  • Section 7.2:Creating an X.509 certificateX).

7.1 Creating an OpenPGP certificate

In the certificate option dialog, click on [Createpersonal OpenPGP key pair].

Now enter your e-mail address and your name inthe following window. Name and e-mail addresswill be made publicly visible later.

You also have the option of adding a comment for the key pair. Usuallythis field stays empty, but if you are creating a key for testpurposes, you should enter 'test' so you do not forget it is a testkey. This comment becomes part of your login name, and will becomepublic just like your name and e-mail address.

If you first wish to test your OpenPGP key pair, you cansimply enter any name and fictional e-mail address, e.g.:
Heinrich Heineand [email protected]

The Advanced settings are only be required in exceptionalcases. For details, see the Kleopatra handbook (viaHelp -> Kleopatra handbook).

Click on [Next].

You will see a list of all of the main entries and settingsfor review purposes. If you are interested in the (default)expert settings, you can view these via the All detailsoption.

If everything is correct, click on [Create key].

Now to the most important part: entering yourpassphrase!

To create a key pair, you must enter your personal passphrase:

If you have read Chapter 4 you should now have aneasy-to-remember but hard to break secret passphrase. Enter it in thedialog displayed at the top.

Please note that this window may have been opened in the backgroundand is not visible at first.

If the passphrase is not secure enough because it is too short or doesnot contain any numbers or special characters, the system will tellyou.

At this point you can also enter a test passphrase or startin earnest; it's up to you.

To make sure that you did not make any typing errors, the system willprompt you to enter your passphrase twice. Always confirm your entrywith [OK].

Now your OpenPGP key pair is being created:

This may take a couple of minutes. You can assist the creation of therequired random numbers by entering information in the lower inputfield. It does not matter what you type, as the characters will not be used, only the time period between each key stroke. You can alsocontinue working with another application on your computer, which willalso slightly increase the quality of the new key pair.

As soon as the key pair creation has been successful, youwill see the following dialog:

The 40-digit 'fingerprint' of your newlygenerated OpenPGP certificate is displayed in the results text field.This fingerprint is unique anywhere in the world, i.e. no other personwill have a certificate with the same fingerprint. Actually, even at8 digits it would already be quite unlikely that the same sequence would occur twice anywhere in world. For this reason, it is often only the last 8 digits of afingerprint which are used or shown, and which are described as thekey ID. This fingerprintidentifies the identity of the certificate as well as the fingerprintof a person.

However, you do not need to remember or write down the fingerprint.You can also display it later in Kleopatra's certificate details.

Next, you can activate one or more of the following three buttons:

Creating a backup copy of your (private) certificate...

Enter the path under which your full certificate (which containsyour new key pair, hence the private and public key) should be exported:

Kleopatra will automatically select the file type and store yourcertificate as an .asc or.gpg file -depending on whether you activate or deactivate the ASCIIarmor option.

For export, click on [OK].

Important: If you save the file on the hard drive, youshould copy the file to another data carrier (USB stick, disketteor CD-ROM) as soon as possible, and delete the original filewithout a trace, i.e. do not leave it in the Recycle bin! Keepthis data carrier and back-up copy in a safe place.

You can also create a back-up copy later; to do this, select thefollowing from the Kleopatra main menu:File -> Export private certificate... (see Chapter19).

Sending a certificate via e-mail ...

Clicking on this button should create a new onee-mail -with your new public certificate in the attachment. Your secretOpen PGP key will of course not be sent. Enter arecipient e-mail address; you can also addmore text to the prepared text for this e-mail.

Please note: Not alle-mail programs support this function. Of course you can also dothis manually: If you do not see anewe-mail window, shut down thecertificate creation assistant, save your public certificate viaFile -> Export certificate and sent this filevia e-mail tothe people you are corresponding with. For more details seeSection 8.1.

Sending certificates to certificate servers...

Chapter explains howto set up a globally available OpenPGP certificate server in Kleopatra,and how you can publish your public certificate on thisserver 16.

This completes the creation of your OpenPGP certificate. End theKleopatra assistant with [Finish].

Now let's go to Section 7.3 onpage X. Starting at that point,the explanations for OpenPGP and X.509 will again be identical.

7.2 Creating an X.509 certificate

In the certificate format selection dialog on page ,X click on the button
[Create personal X.509 key pair and authenticationrequest].

In the following window, enter your name (CN = common name), youre-mail address (EMAIL), organisation (O) andyour country code (C). Optionally, you can also add your location (L =Locality) and department (OU = Organizational Unit).

If you first wish to test the X.509 key pair creationprocess, you can enter any information for name, organization andcountry code, and can also enter a fictional e-mail address, e.g.:CN=HeinrichHeine,O=Test,C=DE,[email protected]

The Advanced settings will only be required in exceptionalcases. For details, see the Kleopatra handbook (viaHelp -> Kleopatra handbook).

Click on [Next].

You will see a list of all main entries and settings for reviewpurposes. If you are interested in the (default) expert settings,you can view these via the All details option.

Once everything is correct, click on [Creat key].

Now to the most important part: Entering your passphrase!

In order to create a key pair, you will be asked to enter yourpassphrase:

If you have read Chapter 4 you should now have aneasy-to-remember but hard to break secret passphrase. Enter it in thedialog displayed at the top!

Please note that this window may have been opened in the background,so it may not be visible at first.

If the passphrase is not secure enough because it is too short or doesnot contain any numbers or special characters, the system will let youknow.

At this point you can also enter a test passphrase or startin earnest; it's up to you.

To make sure that you did not make any typing errors, the system willprompt you to enter your passphrase twice. Finally, you will be askedto enter your passphrase a third time: By doing that, you are sendingyour certificate request to theauthenticating instance in charge. Always confirm your entries with[OK].

Now your X.509 key pair is being created:

This may take a couple of minutes. You can assist the creation of therequired random numbers by entering information in the lower inputfield. It does not matter what you type, as the characters will not be used, only the time period between each key stroke. You can alsocontinue working with other applications on your computer, which willslightly increase the quality of the key pair that is being created.

As soon as the key pair has been successfully created, youwill see the following dialog:

The next steps are triggered with the following buttons:

Save request in file...

Here, you enter the path under whichyour X.509 certificate request should be backed up, and confirmyour entry. Kleopatra will automatically add the file ending .p10during the saving process. This file can then besent to an authentication instance (in short CA for CertificateAuthority). Further below, wewill refer you to cacert.org, which is a non-commercialauthentication instance (CA) that issues X.509 certificates freeof charge.
Sending an request by e-mail ...

Thiscreates a new e-mail with the certificate requestwhich has just been created in the attachment. Enter a recippiente-mail address - usually that of yourcertificate authority in charge; you can also add more textto the prepared text of this e-mail.

Please note: Not all e-mail programs support thisfunction. Of course you can also do this manually: If you do notsee a new e-mailwindow, save your request in a file (see above)and send it by e-mail to your certificate authority (CA).

As soon as the CA has processed your request, the CA systemadministrator will send you the completed X.509 certificate, whichhas been signed by the CA. You only need to import the file intoKleopatra (see Chapter 19).

End the Kleopatra assistant with [Finish].

Creating an X509 certificate using www.cacert.org

CAcert is a non-commercial certificate authority whichissues X.509 certificates free of charge. It offers an alternative tocommercial root CAs, some of which charge very high fees for theircertificates.

To create a (client) certificate at CAcert, you first have to registerat www.cacert.org.

Immediately following registration, you can create one or more clientcertificates on cacert.org: please make sure you have sufficient keylength (e.g. 2048 bits). Use the web assistant to define a securepassphrase for your certificate.

Your client certificate is now created.

Afterwards you will receive an e-mail with twolinks to your new X.509 certificate and associated CAcert rootcertificate. Download both certificates.

Follow the instructions to install the certificate on your browser. InFirefox, you can use e.g. Edit -> Settings -> Advanced -> Certificatesto find your installed certificate under the first tab 'Yourcertificates' with the name (CN) CAcert WoT User.

You can now issue a personal X.509 certificate which has your name inthe CN field. To do this, you must have your CAcert accountauthenticated by other members of the CACert Web of Trust. Informationon obtaining such a confirmation can be found on the Internet pages ofCAcert.

Then save a backup copy of your personal X.509 certificate. Theending .p12 will automatically be appliedto the backup copy.

Attention: This .p12 file contains yourpublic and your private key. Please ensure that this file isprotected againt unauthorised access.

To find out how to import your personal X.509 certificate inKleopatra, see Chapter 19.


Let's now look at Section 7.3 on thenext page. This is where explanations for OpenPGP and X.509 areidentical again.

7.3 Certificate creation process complete

This completes the creation of your OpenPGP or X.509 key pair.You now have a unique electronic key.

During the course of this compendium, we will always use an OpenPGPcertificate for sample purposes - however, all information will alsoapply accordingly to X509 certificates.

You are now back in the Kleopatra main window. The OpenPGP certificatewhich was just created can be found in the certificate administrationunder the tab My certificates:

Double-click on your new certificate to view all details related tothe certificate:

What do the certificate details mean?

Your certificate is valid indefinitely, i.e. it has no 'built-inexpiry date'. To change its validity at a later point, clickon [Change expiry date].

For more details about the certificate, seeChapter 15.

© 31. August 2010, v3.0.0-beta1 (last minor changes from 21. September 2010)
The Gpg4win Compendium is filed under theGNU Free Documentation License v1.2.


7 Creating a certificateContents

Old Man Page

This is a very old version of the gpg man page. 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
Gpg4win Command Line Generate Key

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.

Gpg4win Command Line Generate Key
--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.

Gpg4win Command Line Generate Key Codes

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

Gpg4win Command Line Generate Key Code

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

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

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

Gpg4win Command Line Generate Key Download

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

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

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!

BUGS

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.

Coments are closed
Scroll to top