Hi, I got a problem generating a key pair, when I run the code, it return a General error code :/. If you could give me a sample on how to gen a key or fix my code it would be nice :)
your sincerely, F. gpgme_set_global_flag("debug", "9"); gpgme_set_global_flag("disable-gpgconf","1"); gpgme_set_global_flag("gpg-name","gpgconf"); cout << "cououcou" << endl; gpgme_check_version(NULL); gpgme_engine_check_version(GPGME_PROTOCOL_OpenPGP); gpgme_set_engine_info(GPGME_PROTOCOL_OpenPGP,NULL,"CHOME"); gpgme_ctx_t ctx; gpgme_error_t err; gpgme_data_t pubkey; gpgme_data_t privkey; setlocale (LC_ALL, ""); gpgme_set_locale (NULL, LC_CTYPE, setlocale (LC_CTYPE, NULL)); #ifdef LC_MESSAGES gpgme_set_locale (NULL, LC_MESSAGES, setlocale (LC_MESSAGES, NULL)); #endif err = gpgme_new(&ctx); if(err!=GPG_ERR_NO_ERROR) return err; err = gpgme_set_protocol(ctx,GPGME_PROTOCOL_OpenPGP); if(err!=GPG_ERR_NO_ERROR) return err; gpgme_set_armor(ctx,1); gpgme_set_offline(ctx,1); string req = "<GnupgKeyParms format=\"internal\">"; req += "\nKey-Type: RSA"; req += "\nKey-length: 1024"; req += "\nName-Real: " + student.getFname() + " " + student.getLname(); req += "\nName-Comment: " + student.getAddress(); req += " " + student.getCity(); req += " " + student.getZip(); req += " " + student.getCountry(); req += "\nExpire-Date: 0"; req += "\nPassphrase: bla"; req += "\n</GnupgKeyParms>"; cout << "Sgen "; gpgme_data_new(&pubkey); gpgme_data_new(&privkey); gpgme_data_set_encoding(privkey,GPGME_DATA_ENCODING_ARMOR); gpgme_data_set_encoding(pubkey,GPGME_DATA_ENCODING_ARMOR); const char* param = req.c_str(); err = gpgme_op_genkey(ctx,param,NULL,NULL); cout << "Egen" << endl; if(err!=GPG_ERR_NO_ERROR) return err; _______________________________________________ Gnupg-users mailing list Gnupg-users@gnupg.org http://lists.gnupg.org/mailman/listinfo/gnupg-users