Openssl: error: "EC_PRIVATEKEY_it" not specified here (not in function)

I am using openssl 1.0.2c on Linux and I am trying to modify a program that is currently using a custom ASN1 sequence that includes an object RSAPrivateKey

.

ASN1_NDEF_SEQUENCE(MY_DATA) =
{
    ASN1_SIMPLE(MY_DATA, version, ASN1_INTEGER),
    ASN1_SIMPLE(MY_DATA, key_block_hdr, ASN1_IA5STRING),
    ASN1_SIMPLE(MY_DATA, priv_key, RSAPrivateKey),
    ASN1_SIMPLE(MY_DATA, cert, X509),
    ASN1_OPT(MY_DATA, sign_time, ASN1_UTCTIME)

} ASN1_NDEF_SEQUENCE_END(MY_DATA)

IMPLEMENT_ASN1_FUNCTIONS(MY_DATA)

      

It works fine, but now I need to pass the EC key, so I changed the third object to EC_PRIVATEKEY

(among other changes of course)

ASN1_SIMPLE(MY_DATA, priv_key, EC_PRIVATEKEY),

      

This results in the following compilation error.

error: 'EC_PRIVATEKEY_it' undeclared here (not in a function)

      

I spend a lot of time on the openssl ( rsa_asn1.c

/ ec_asn1.c

) source and I don't understand why it is RSAPrivateKey_it

allowed but not EC_PRIVATEKEY_it

.

I "solved" the compilation problem (blindly) by adding the following line

`DECLARE_ASN1_ITEM(EC_PRIVATEKEY)`

      

But this is clearly not the case, because now I get a segfault for a call d2i_ECPrivateKey_bio()

that populates the structure.

Now I'm wondering if there are any restrictions with EC keys. In other words, am I trying to do something that is not possible or supported, or am I just not doing it right? The latter is more than likely, so any pointers in the right direction are welcome.

Thank.

+3


source to share





All Articles