On Fri, Jul 17, 2009, Chris Bare wrote:
> I'm trying to read in a CVResponse sequence using d2i_CVResponse based on a
> structure I've defined. I get the following errors:
>
> 140033302341272:error:0D0780AA:asn1 encoding
> routines:ASN1_ITEM_EX_D2I:illegal options on item
> template:tasn_dec.c:192:Type=GENERAL_NAMES
> 140033302341272:error:0D08303A:asn1 encoding
> routines:ASN1_TEMPLATE_NOEXP_D2I:nested asn1
> error:tasn_dec.c:738:Field=requestorRef, Type=CVResponse
>
> Here's the spec I'm trying to implement:
> /******
> CVRequest ::= SEQUENCE {
> cvRequestVersion INTEGER DEFAULT 1,
> query Query,
> requestorRef [0] GeneralNames OPTIONAL,
> requestNonce [1] OCTET STRING OPTIONAL,
> requestorName [2] GeneralName OPTIONAL,
> responderName [3] GeneralName OPTIONAL,
> requestExtensions [4] Extensions OPTIONAL,
> signatureAlg [5] AlgorithmIdentifier OPTIONAL,
> hashAlg [6] OBJECT IDENTIFIER OPTIONAL,
> requestorText [7] UTF8String (SIZE (1..256)) OPTIONAL }
> *******/
>
> and what I've defined so far:
>
> typedef struct {
> ASN1_INTEGER *cvRequestVersion;
> Query *query;
> GENERAL_NAMES *requestorRef;
> ASN1_OCTET_STRING *requestNonce;
> //incomplete
> } CVRequest;
>
> ASN1_SEQUENCE(CVRequest) = {
> ASN1_SIMPLE(CVRequest, cvRequestVersion, ASN1_INTEGER),
> ASN1_SIMPLE(CVRequest, query, Query),
> ASN1_IMP_OPT(CVRequest, requestorRef, GENERAL_NAMES, 0),
> ASN1_IMP_OPT(CVRequest, requestNonce, ASN1_OCTET_STRING, 1)
> } ASN1_SEQUENCE_END(CVRequest)
>
> IMPLEMENT_ASN1_FUNCTIONS(CVRequest)
>
> Is the error complaining out the structure I have defined, or the der data it
> is trying to process?
> As far as I can tell the der data doesn't even contain a requestorRef.
> Any suggestions?
>
The GENERAL_NAMES structure is already a template and you can't template a
template. This isn't a problem in practice because if you use
ASN1_IMP_SEQUENCE_OF_OPT with GENERAL_NAME you get exactly the same result,
well except that it works ;-)
Steve.
--
Dr Stephen N. Henson. OpenSSL project core developer.
Commercial tech support now available see: http://www.openssl.org
______________________________________________________________________
OpenSSL Project http://www.openssl.org
User Support Mailing List [email protected]
Automated List Manager [email protected]