Re: Generating NIST/Brainpool subkeys with GPGME

2018-07-03 Thread Werner Koch
On Mon,  2 Jul 2018 18:03, tookm...@gmail.com said:

> Should I file a bug against GPGME? GPG? Not really sure where the
> problem is here.

Against gpg.  I won't assign it a high priority, though.


Shalom-Salam,

   Werner

-- 
#  Please read:  Daniel Ellsberg - The Doomsday Machine  #
Die Gedanken sind frei.  Ausnahmen regelt ein Bundesgesetz.


pgpJjhMEGMK8J.pgp
Description: PGP signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Re: Generating NIST/Brainpool subkeys with GPGME

2018-07-02 Thread Jacob Adams
On 07/02/2018 02:37 AM, Werner Koch wrote:
> On Fri, 29 Jun 2018 22:07, tookm...@gmail.com said:
>> It appears that one cannot currently generate NIST or Brainpool subkeys
>> with GPGME. Using GPG itself works fine with --expert, so am I missing
>> an option or is this simply not possible yet?
> 
> That is likely a bug.  > In contrast to the cv25519 and ed25519 curves this 
> (and the NIST curves)
> don't have an implict algorithm.  Thus gpg tries to deduce this from the
> usage parameter but that seems not to work. 


Should I file a bug against GPGME? GPG? Not really sure where the
problem is here.

> What you hsould do is to
> make it explicit:
> 
>   ./eccsubkeys brainpoolP384r1/ecdsa sign

Some testing confirms that I just need to add "/ecdsa" when creating a
signing or authentication key.

Thanks for your help!

Jacob





signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users


Generating NIST/Brainpool subkeys with GPGME

2018-06-29 Thread Jacob Adams
It appears that one cannot currently generate NIST or Brainpool subkeys
with GPGME. Using GPG itself works fine with --expert, so am I missing
an option or is this simply not possible yet?

I've attached a simple test program and the output I get on my machine
is below:

./eccsubkeys rsa1024
GPGME Version: 1.11.1
GPG Version: 2.2.8
Master: 2D14FBF15919954E4334D451C67CB3237C3CFFF4
Signing: A8B50168D9051846A570445A5DD5249F5CD0825F
Encryption: F8D8B9A453E5A7E98F44CC029F8450A1638414BE
Authentication: 866E75EDC8BDEB4B5A4DBD62865FAF7AB6DE6367

./eccsubkeys nistp384


GPGME Version: 1.11.1
GPG Version: 2.2.8
Master: 27A05F867C37442B675CFC1B9C647EA952B0D156
GPGME: General error

./eccsubkeys brainpoolP384r1


GPGME Version: 1.11.1
GPG Version: 2.2.8
Master: 26B2C8D94AD12A160262C82FED06C709E119D584
GPGME: General error


Thanks,
Jacob
#define  _POSIX_C_SOURCE 200809L
#include 
#include 
#include 

int main(int argc, char **argv)
{
	if (argc < 2)
	{
		puts("Need algorithm!");
		return 1;
	}
	const char *version = gpgme_check_version(NULL);
	printf("GPGME Version: %s\n", version);
	gpgme_ctx_t ctx;
	gpgme_error_t err = gpgme_new();
	if (!err)
	{
		char template[] = "/tmp/gnupg.XX";
		char *homedir = mkdtemp(template);
		gpgme_engine_info_t eng = gpgme_ctx_get_engine_info(ctx);
		printf("GPG Version: %s\n", eng->version);
		err = gpgme_ctx_set_engine_info(ctx, GPGME_PROTOCOL_OPENPGP,
eng->file_name, homedir);
		if (!err)
		{
			gpgme_genkey_result_t result;
			err = gpgme_op_createkey(ctx, "test ", argv[1],
	0, 0, NULL, GPGME_CREATE_CERT);
			if (!err)
			{
result = gpgme_op_genkey_result(ctx);
printf("Master: %s\n", result->fpr);
err = gpgme_op_keylist_start(ctx, "", 1);
if (!err)
{
	gpgme_key_t key;
	err = gpgme_op_keylist_next(ctx, );
	if (!err)
	{
		err = gpgme_op_createsubkey(ctx, key, argv[1], 0, 0,
GPGME_CREATE_SIGN);
		if (!err)
		{
			result = gpgme_op_genkey_result(ctx);
			printf("Signing: %s\n", result->fpr);
			err = gpgme_op_createsubkey(ctx, key, argv[1], 0,
	0, GPGME_CREATE_ENCR);
			if (!err)
			{
result = gpgme_op_genkey_result(ctx);
printf("Encryption: %s\n", result->fpr);
err = gpgme_op_createsubkey(ctx, key, argv[1],
		0, 0, GPGME_CREATE_AUTH);
if (!err)
{
	result = gpgme_op_genkey_result(ctx);
	printf("Authentication: %s\n", result->fpr);
}
			}
		}
	}
}
			}
		}
	}

	if (err)
	{
		const char *strerror = gpgme_strerror(err);
		const char *strsource = gpgme_strsource(err);
		fprintf(stderr, "%s: %s\n", strsource, strerror);
		return 2;
	}
	return 0;
}


signature.asc
Description: OpenPGP digital signature
___
Gnupg-users mailing list
Gnupg-users@gnupg.org
http://lists.gnupg.org/mailman/listinfo/gnupg-users