Matt,

You are correct, using the standard installed libraries for Ubuntu 12.10 
(OpenSSL 1.0.1 14 Mar 2012), my test app successfully creates EC keys and 
successfully sign and verify some data for all types of curves of all sizes.

The private key however seems to be bigger (more chars in PEM format)? Here is 
the one created from the "sect233r1" curve:
-----BEGIN PRIVATE KEY-----
MIIBOQIBADCBywYHKoZIzj0CATCBvwIBATAdBgcqhkjOPQECMBICAgDpBgkqhkjO
PQECAwICAUowOQQBAQQdZmR+3mwzLH+MCSO7WCE7Mzsg6c5Cgf4RX32PkK0DFQB0
1Z/wf2tBPQ6hSzRLIKLbBJtQwwQ9BAD6yd/LrIMTuyE58bt1X+9lvDkfizb4+Otz
cf1ViwEAagikGQM1BnjlhSi+v4oL7/hnp8o2cW9+AfgQUgIeAQAAAAAAAAAAAAAA
AAAAE+l05y+KaSIDHSYDz+DXAgECBGYwZAIBAQQdkgFHGcub3q4KILP17VudtpDC
4KS7qMLPA/XpkHKhQAM+AAQAVdHQVSgvfEKnoAzxQu3++YjR60UjmimJUTzTB9QB
zwNjc/gjDH6ex4ehhC9BsJ4L6nhphsegp57bIDM=
-----END PRIVATE KEY-----

NEW:
I changed my compile to again use my FIPS compiled OpenSSL libraries and I got 
some new errors from the Binary and Kolbitz curves. Prime curves are still 
working just fine.

First off the private key created with the "sect233r1" curve are:
-----BEGIN PRIVATE KEY-----
MHYCAQAwCQYHKoZIzj0CAQRmMGQCAQEEHVnVyx1BHVTaKFSi758nc0v1SnWNQ1aR
BYRjL4ZboUADPgAEAVZmnrloR8NnuKI7pzD8n8UYXHannulPUv2JVqeiAXI1bnBR
K10brlEGKzKztusdvxC6UVz1Ew9eVvcL
-----END PRIVATE KEY-----

It does contain less information - I am not an expert but this seems wrong?

Next, after creating these PEM formatted private and public keys I test them 
doing a sign and verify operation. I do this in a loop which excercises all the 
supported digests, but they all fail before the function get to do the actual 
sign/verify. The initial attempt to sign gives the following error when I try 
to read the PEM formatted private key using PEM_read_bio_PrivateKey():

(error:0B07707D:x509 certificate routines:X509_PUBKEY_get:public key decode 
error)

The loop then tries to verify the generated signature, which will fail since no 
signature was created, but again the code does not reach the verify function. I 
get the following error when I try to read the PEM formatted public key using 
PEM_read_bio_PUBKEY():

(error:100BF078:elliptic curve routines:i2d_ECPKParameters:group2pkparameters 
failure)

The loop tries the next digest, which again reads the _same_ PEM formatted 
private key as using PEM_read_bio_PrivateKey() and I get a different error:

(error:100C1042:elliptic curve routines:EC_GROUP_get_pentanomial_basis:called a 
function you should not call)

For the verify I also get a different error when parsing the public key with 
PEM_read_bio_PUBKEY():

(error:100D5010:elliptic curve routines:ECKEY_PRIV_DECODE:EC lib)

The loop continues with the next digest, which again fails to read the same PEM 
formatted private key as using PEM_read_bio_PrivateKey():

(error:100D7010:elliptic curve routines:ECKEY_PUB_DECODE:EC lib)

The last errors repeat for all the following attempt to parse the PEM formatted 
private and public keys in the digest loop.

So, to conclude: It seems that this is a FIPS related problem. The keys simply 
seems incorrect and will therefore cause all the errors I now see. But, I do 
not get why a will get different errors when reading the exact same PEM 
formatted key. Or, why it all works for NIST prime curves?

Any comment or help is appreciated
Leon Brits 

> -----Original Message-----
> From: owner-openssl-...@openssl.org [mailto:owner-openssl-...@openssl.org]
> On Behalf Of Matt Caswell
> Sent: 20 March 2013 11:11 PM
> To: openssl-dev@openssl.org
> Subject: Re: EVP and Elliptic curve
> 
> On 20 March 2013 07:14, Leon Brits <le...@parsec.co.za> wrote:
> > Hi Matt,
> >
> > I use:
> > $ openssl version
> > OpenSSL 1.0.1e-fips 11 Feb 2013
> >
> > I was able to successfully parse your attached private key.
> > I've attached my smallest prime, binary and kolbitz curve key pairs. As
> I said the prime curve parses correct with the openssl command line tool
> but not the binary curve keys.
> >
> > Regards,
> > Leon Brits
> >
> 
> Well, I am unable to reproduce your problem, my code works fine under
> vanilla OpenSSL 1.0.1e. I don't have a fips build environment so it could
> be a fips issue. Are you able to test your code under normal non-fips
> openssl and see if you still get the same problem?
> 
> Matt
> ______________________________________________________________________
> OpenSSL Project                                 http://www.openssl.org
> Development Mailing List                       openssl-dev@openssl.org
> Automated List Manager                           majord...@openssl.org


______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       openssl-dev@openssl.org
Automated List Manager                           majord...@openssl.org

Reply via email to