Hi Massimiliano,

I don't know if that's the best solution, but it worked for me that way:

in crmf.h:

typedef struct crmf_certreqmsg_st
{
=BB=B7=B7=B7=B7=B7=B7=B7CRMF_CERTREQUEST *certReq;
=BB=B7=B7=B7=B7=B7=B7=B7CRMF_PROOFOFPOSSESION *popo; /* 0 */
=BB=B7=B7=B7=B7=B7=B7=B7CRMF_ATTRIBUTETYPEANDVALUE *regInfo; /* 1 */
} CRMF_CERTREQMSG;
DECLARE_ASN1_FUNCTIONS(CRMF_CERTREQMSG)

DECLARE_STACK_OF(CRMF_CERTREQMSG) /* CertReqMessages */
DECLARE_ASN1_SET_OF(CRMF_CERTREQMSG) /* CertReqMessages */


in crmf_asn.c:

ASN1_SEQUENCE(CRMF_CERTREQMSG) =3D {
=BB=B7=B7=B7=B7=B7=B7=B7ASN1_SIMPLE(CRMF_CERTREQMS G, certReq, CRMF_CERTREQU=
EST),
=BB=B7=B7=B7=B7=B7=B7=B7ASN1_IMP_OPT(CRMF_CERTREQM SG, popo, CRMF_PROOFOFPOS=
SESION, 0),
=BB=B7=B7=B7=B7=B7=B7=B7ASN1_IMP_SEQUENCE_OF_OPT(C RMF_CERTREQMSG, regInfo,
CRMF_ATTRIBUTETYPEANDVALUE, 1)
} ASN1_SEQUENCE_END(CRMF_CERTREQMSG)

IMPLEMENT_ASN1_FUNCTIONS(CRMF_CERTREQMSG)


I needed it for CMP. In order to use the "CertReqMessages", I am doing:

In cmp.h:
typedef struct cmp_pkibody_st
{
=BB=B7=B7=B7=B7=B7=B7=B7int type;
=BB=B7=B7=B7=B7=B7=B7=B7union{
=BB=B7=B7=B7=B7=B7=B7=B7=BB=B7=B7=B7=B7=B7=B7=B7ST ACK_OF(CRMF_CERTREQMSG) =
*ir; /* 0 */
....

In cmp_asn.c:
ASN1_CHOICE(CMP_PKIBODY) =3D {
=BB=B7=B7=B7=B7=B7=B7=B7ASN1_EXP_SEQUENCE_OF(CMP_P KIBODY, value.ir, CRMF_CE=
RTREQMSG, 0),
....


There might be other ways to do it - the OpenSSL ASN.1 documentation
seems to be not complete - but it works fine that way.

As there are not many things to use CRMF for: what are you
implementing? Do you know my code to use CMP with OpenSSL? You can
obtain the full code including the snippets I pasted above from
.

Best regards,
Martin




On 4/3/08, Massimiliano Pala wrote:
> Hi guys,
>
> I am stuck with a simple (hopefully) problem that I do not know how to
> solve.
> In particular I am trying to implement a CRMF simple interface. But I am
> not
> sure how to code the CertReqMessages. From the ASN.1 specification
> (rfc4211)
> it should be:
>
> CertReqMessages ::=3D SEQUENCE SIZE (1..MAX) OF CertReqMsg
>
> Initially I implemented it as:
>
> ASN1_SEQUENCE (CRMF_REQ) =3D {
> ASN1_SEQUENCE_OF( CRMF_REQ, requests, CRMF_CERT_REQ_MESSAGE )
> } ASN1_SEQUENCE_END(CRMF_REQ)
>
> IMPLEMENT_ASN1_FUNCTIONS(CRMF_REQ)
>
> and the related:
>
> typedef struct crmfReq_st {
> STACK_OF(CRMF_CERT_REQ_MESSAGE) *requests;
> } CRMF_REQ;
>
> DECLARE_ASN1_FUNCTIONS(CRMF_REQ)
>
>
> Would this work ? Or because it would be something like:
>
> SEQUENCE
> SEQUENCE OF CRMF_CERT_REQ_MESSAGE
>
> it will not ? (Instead of being just one SEQUENCE is a SEQUENCE of a
> SEQUENCE). How do I solve my problem ?
>
>
> --
>
> Best Regards,
>
> Massimiliano Pala
>
> --o----------------------------------------------------------------------=

--
> Massimiliano Pala [OpenCA Project Manager] pala@cs.dartmouth.=

edu
> project.manager@openca.o=

rg
>
> Dartmouth Computer Science Dept Home Phone: +1 (603) 397-3=

883
> PKI/Trust - Office 063 Work Phone: +1 (603) 646-9=

179
> --o----------------------------------------------------------------------=

--
>
>

__________________________________________________ ____________________
OpenSSL Project http://www.openssl.org
Development Mailing List openssl-dev@openssl.org
Automated List Manager majordomo@openssl.org