Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
cmmfasn1.c File Reference
#include "cmmf.h"
#include "cmmfi.h"
#include "secasn1.h"
#include "secitem.h"

Go to the source code of this file.

Functions

SECStatus CMMF_EncodeCertRepContent (CMMFCertRepContent *inCertRepContent, CRMFEncoderOutputCallback inCallback, void *inArg)
SECStatus CMMF_EncodePOPODecKeyChallContent (CMMFPOPODecKeyChallContent *inDecKeyChall, CRMFEncoderOutputCallback inCallback, void *inArg)
CMMFPOPODecKeyRespContent * CMMF_CreatePOPODecKeyRespContentFromDER (const char *buf, long len)
SECStatus CMMF_EncodeKeyRecRepContent (CMMFKeyRecRepContent *inKeyRecRep, CRMFEncoderOutputCallback inCallback, void *inArg)
CMMFKeyRecRepContent * CMMF_CreateKeyRecRepContentFromDER (CERTCertDBHandle *db, const char *buf, long len)

Variables

static const SEC_ASN1Template CMMFSequenceOfCertifiedKeyPairsTemplate []
static const SEC_ASN1Template CMMFKeyRecRepContentTemplate []

Function Documentation

CMMFKeyRecRepContent* CMMF_CreateKeyRecRepContentFromDER ( CERTCertDBHandle *  db,
const char *  buf,
long  len 
)

Definition at line 124 of file cmmfasn1.c.

{
    PRArenaPool          *poolp;
    CMMFKeyRecRepContent *keyRecContent;
    SECStatus             rv;

    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        return NULL;
    }
    keyRecContent = PORT_ArenaZNew(poolp, CMMFKeyRecRepContent);
    if (keyRecContent == NULL) {
        goto loser;
    }
    keyRecContent->poolp = poolp;
    rv = SEC_ASN1Decode(poolp, keyRecContent, CMMFKeyRecRepContentTemplate,
                     buf, len);
    if (rv != SECSuccess) {
        goto loser;
    }
    if (keyRecContent->keyPairHist != NULL) {
        while(keyRecContent->keyPairHist[keyRecContent->numKeyPairs] != NULL) {
           rv = cmmf_decode_process_certified_key_pair(poolp, db,
                     keyRecContent->keyPairHist[keyRecContent->numKeyPairs]);
           if (rv != SECSuccess) {
               goto loser;
           }
           keyRecContent->numKeyPairs++;
       }
       keyRecContent->allocKeyPairs = keyRecContent->numKeyPairs;
    }
    keyRecContent->isDecoded = PR_TRUE;
    return keyRecContent;
 loser:
    if (poolp != NULL) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}
CMMFPOPODecKeyRespContent* CMMF_CreatePOPODecKeyRespContentFromDER ( const char *  buf,
long  len 
)

Definition at line 85 of file cmmfasn1.c.

{
    PRArenaPool               *poolp;
    CMMFPOPODecKeyRespContent *decKeyResp;
    SECStatus                  rv;

    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        return NULL;
    }
    decKeyResp = PORT_ArenaZNew(poolp, CMMFPOPODecKeyRespContent);
    if (decKeyResp == NULL) {
        goto loser;
    }
    decKeyResp->poolp = poolp;
    rv = SEC_ASN1Decode(poolp, decKeyResp, CMMFPOPODecKeyRespContentTemplate,
                     buf, len);
    if (rv != SECSuccess) {
        goto loser;
    }
    return decKeyResp;
    
 loser:
    if (poolp != NULL) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}
SECStatus CMMF_EncodeCertRepContent ( CMMFCertRepContent *  inCertRepContent,
CRMFEncoderOutputCallback  inCallback,
void inArg 
)

Definition at line 67 of file cmmfasn1.c.

{
    return cmmf_user_encode(inCertRepContent, inCallback, inArg,
                         CMMFCertRepContentTemplate);
}
SECStatus CMMF_EncodeKeyRecRepContent ( CMMFKeyRecRepContent *  inKeyRecRep,
CRMFEncoderOutputCallback  inCallback,
void inArg 
)

Definition at line 115 of file cmmfasn1.c.

{
    return cmmf_user_encode(inKeyRecRep, inCallback, inArg,
                         CMMFKeyRecRepContentTemplate);
}
SECStatus CMMF_EncodePOPODecKeyChallContent ( CMMFPOPODecKeyChallContent *  inDecKeyChall,
CRMFEncoderOutputCallback  inCallback,
void inArg 
)

Definition at line 76 of file cmmfasn1.c.

{
    return cmmf_user_encode(inDecKeyChall, inCallback, inArg,
                         CMMFPOPODecKeyChallContentTemplate);
}

Variable Documentation

Initial value:

Definition at line 49 of file cmmfasn1.c.

Initial value:

Definition at line 45 of file cmmfasn1.c.