GNU Info

Info Node: (gpgme.info)Generating Keys

(gpgme.info)Generating Keys


Next: Exporting Keys Prev: Manipulating Keys Up: Key Management
Enter node , (file) or (file)node

Generating Keys
---------------

 - Function: GpgmeError gpgme_op_genkey (GpgmeCtx CTX,
          const char *PARMS, GpgmeData PUBKEY, GpgmeData SECKEY)
     The function `gpgme_op_genkey' generates a new key pair in the
     context CTX and puts it into the standard key ring if both PUBKEY
     and SECKEY are `NULL'.  In this case the function returns
     immediately after starting the operation, and does not wait for it
     to complete.  If PUBKEY is not `NULL' it should be the handle for
     an empty (newly created) data object, and upon successful
     completion the data object will contain the public key.  If SECKEY
     is not `NULL' it should be the handle for an empty (newly created)
     data object, and upon successful completion the data object will
     contain the secret key.

     Note that not all crypto engines support this interface equally.
     GnuPG does not support PUBKEY and SUBKEY, they should be both
     `NULL', and the key pair will be added to the standard key ring.
     GpgSM does only support PUBKEY, the secret key will be stored by
     `gpg-agent'.  GpgSM expects PUBKEY being not `NULL'.

     The argument PARMS specifies parameters for the key in an XML
     string.  The details about the format of PARMS are specific to the
     crypto engine used by CTX.  Here is an example for GnuPG as the
     crypto engine:

          <GnupgKeyParms format="internal">
          Key-Type: DSA
          Key-Length: 1024
          Subkey-Type: ELG-E
          Subkey-Length: 1024
          Name-Real: Joe Tester
          Name-Comment: with stupid passphrase
          Name-Email: joe@foo.bar
          Expire-Date: 0
          Passphrase: abc
          </GnupgKeyParms>

     Here is an example for GpgSM as the crypto engine:
          <GnupgKeyParms format="internal">
          Key-Type: RSA
          Key-Length: 1024
          Name-DN: C=de,O=g10 code,OU=Testlab,CN=Joe 2 Tester
          Name-Email: joe@foo.bar
          </GnupgKeyParms>

     Strings should be given in UTF-8 encoding.  The only format
     supported for now is "internal".  The content of the
     `GnupgKeyParms' container is passed verbatim to GnuPG.  Control
     statements are not allowed.

     The function returns `GPGME_No_Error' if the operation could be
     started successfully, `GPGME_Invalid_Value' if PARMS is not a
     valid XML string, `GPGME_Not_Supported' if PUBKEY or SECKEY is not
     valid, and `GPGME_General_Error' if no key was created by the
     backend.

 - Function: GpgmeError gpgme_op_genkey_start (GpgmeCtx CTX,
          const char *PARMS, GpgmeData PUBKEY, GpgmeData SECKEY)
     The function `gpgme_op_genkey_start' initiates a `gpgme_op_genkey'
     operation.  It can be completed by calling `gpgme_wait' on the
     context.  Note: Waiting For Completion.

     The function returns `GPGME_No_Error' if the operation could be
     started successfully, `GPGME_Invalid_Value' if PARMS is not a
     valid XML string, and `GPGME_Not_Supported' if PUBKEY or SECKEY is
     not `NULL'.


automatically generated by info2www version 1.2.2.9