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
{
»·······CRMF_CERTREQUEST           *certReq;
»·······CRMF_PROOFOFPOSSESION      *popo;    /* 0 */
»·······CRMF_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) = {
»·······ASN1_SIMPLE(CRMF_CERTREQMSG, certReq, CRMF_CERTREQUEST),
»·······ASN1_IMP_OPT(CRMF_CERTREQMSG, popo, CRMF_PROOFOFPOSSESION, 0),
»·······ASN1_IMP_SEQUENCE_OF_OPT(CRMF_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
{
»·······int type;
»·······union{
»·······»·······STACK_OF(CRMF_CERTREQMSG)   *ir;   /* 0 */
...

In cmp_asn.c:
ASN1_CHOICE(CMP_PKIBODY) = {
»·······ASN1_EXP_SEQUENCE_OF(CMP_PKIBODY, value.ir, CRMF_CERTREQMSG, 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
<http://www.izac.de/cmp>.

Best regards,
Martin




On 4/3/08, Massimiliano Pala <[EMAIL PROTECTED]> 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 ::= SEQUENCE SIZE (1..MAX) OF CertReqMsg
>
>  Initially I implemented it as:
>
>    ASN1_SEQUENCE (CRMF_REQ) = {
>         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]            [EMAIL PROTECTED]
>                                                  [EMAIL PROTECTED]
>
>  Dartmouth Computer Science Dept               Home Phone: +1 (603) 397-3883
>  PKI/Trust - Office 063                        Work Phone: +1 (603) 646-9179
> --o------------------------------------------------------------------------
>
>
______________________________________________________________________
OpenSSL Project                                 http://www.openssl.org
Development Mailing List                       [email protected]
Automated List Manager                           [EMAIL PROTECTED]

Reply via email to