Re: [openssl-users] Raw EC key to EVP_PKEY to certificate

2016-12-31 Thread Ken Goldman

Perfect, thanks.

On 12/30/2016 8:27 PM, Viktor Dukhovni wrote:



On Dec 30, 2016, at 8:20 PM, Ken Goldman  wrote:

- EC_KEY ecKey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)
- convert x and y from bin to bignum
- EC_KEY_set_public_key_affine_coordinates(ecKey, x, y)
- EVP_PUBKEY evpPubkey = EVP_PKEY_new()
- EVP_PKEY_set1_EC_KEY(evpPubkey, ecKey);
- X509_set_pubkey(x509Certificate, evpPubkey);


Start with:

EC_KEY *eckey = EC_KEY_new();
EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1);
EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
EC_KEY_set_group(eckey, group);
...




--
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users


Re: [openssl-users] Raw EC key to EVP_PKEY to certificate

2016-12-30 Thread Viktor Dukhovni

> On Dec 30, 2016, at 8:20 PM, Ken Goldman  wrote:
> 
> - EC_KEY ecKey = EC_KEY_new_by_curve_name(NID_X9_62_prime256v1)
> - convert x and y from bin to bignum
> - EC_KEY_set_public_key_affine_coordinates(ecKey, x, y)
> - EVP_PUBKEY evpPubkey = EVP_PKEY_new()
> - EVP_PKEY_set1_EC_KEY(evpPubkey, ecKey);
> - X509_set_pubkey(x509Certificate, evpPubkey);

Start with:

EC_KEY *eckey = EC_KEY_new();
EC_GROUP *group = EC_GROUP_new_by_curve_name(NID_X9_62_prime256v1);
EC_GROUP_set_asn1_flag(group, OPENSSL_EC_NAMED_CURVE);
EC_KEY_set_group(eckey, group);
...

-- 
Viktor.

-- 
openssl-users mailing list
To unsubscribe: https://mta.openssl.org/mailman/listinfo/openssl-users