Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
asn1cmn.c File Reference
#include "nssrenam.h"
#include "cmmf.h"
#include "cmmfi.h"

Go to the source code of this file.

Functions

SECStatus cmmf_decode_process_cert_response (PRArenaPool *poolp, CERTCertDBHandle *db, CMMFCertResponse *inCertResp)
static CERTCertificate * cmmf_DecodeDERCertificate (CERTCertDBHandle *db, SECItem *derCert)
static CMMFCertOrEncCertChoice cmmf_get_certorenccertchoice_from_der (SECItem *der)
static SECStatus cmmf_decode_process_certorenccert (PRArenaPool *poolp, CERTCertDBHandle *db, CMMFCertOrEncCert *inCertOrEncCert)
SECStatus cmmf_decode_process_certified_key_pair (PRArenaPool *poolp, CERTCertDBHandle *db, CMMFCertifiedKeyPair *inCertKeyPair)

Variables

static const SEC_ASN1Template CMMFCertResponseTemplate []
static const SEC_ASN1Template CMMFCertOrEncCertTemplate []
const SEC_ASN1Template CMMFCertifiedKeyPairTemplate []
const SEC_ASN1Template CMMFPKIStatusInfoTemplate []
const SEC_ASN1Template CMMFSequenceOfCertsTemplate []
const SEC_ASN1Template CMMFRandTemplate []
const SEC_ASN1Template CMMFPOPODecKeyRespContentTemplate []
const SEC_ASN1Template CMMFCertOrEncCertEncryptedCertTemplate []
const SEC_ASN1Template CMMFCertOrEncCertCertificateTemplate []
const SEC_ASN1Template CMMFCertRepContentTemplate []
static const SEC_ASN1Template CMMFChallengeTemplate []
const SEC_ASN1Template CMMFPOPODecKeyChallContentTemplate []

Function Documentation

SECStatus cmmf_decode_process_cert_response ( PRArenaPool poolp,
CERTCertDBHandle *  db,
CMMFCertResponse *  inCertResp 
)

Definition at line 151 of file asn1cmn.c.

{
    SECStatus rv = SECSuccess;
  
    if (inCertResp->certifiedKeyPair != NULL) {
        rv = cmmf_decode_process_certified_key_pair(poolp, 
                                              db,
                                          inCertResp->certifiedKeyPair);
    }
    return rv;
}

Here is the caller graph for this function:

SECStatus cmmf_decode_process_certified_key_pair ( PRArenaPool poolp,
CERTCertDBHandle *  db,
CMMFCertifiedKeyPair *  inCertKeyPair 
)

Definition at line 244 of file asn1cmn.c.

{
    return cmmf_decode_process_certorenccert (poolp,
                                         db,
                                         &inCertKeyPair->certOrEncCert);
}

Here is the caller graph for this function:

static SECStatus cmmf_decode_process_certorenccert ( PRArenaPool poolp,
CERTCertDBHandle *  db,
CMMFCertOrEncCert *  inCertOrEncCert 
) [static]

Definition at line 194 of file asn1cmn.c.

{
    SECStatus rv = SECSuccess;

    inCertOrEncCert->choice = 
        cmmf_get_certorenccertchoice_from_der(&inCertOrEncCert->derValue);

    switch (inCertOrEncCert->choice) {
    case cmmfCertificate:
        {
           /* The DER has implicit tagging, so we gotta switch it to 
            * un-tagged in order for the ASN1 parser to understand it.
            * Saving the bits that were changed.
            */ 
           inCertOrEncCert->derValue.data[0] = 0x30;
           inCertOrEncCert->cert.certificate = 
               cmmf_DecodeDERCertificate(db, &inCertOrEncCert->derValue);
           if (inCertOrEncCert->cert.certificate == NULL) {
               rv = SECFailure;
           }
       
       }
       break;
    case cmmfEncryptedCert:
       PORT_Assert(poolp);
       if (!poolp) {
           PORT_SetError(SEC_ERROR_INVALID_ARGS);
           rv = SECFailure;
           break;
       }
        inCertOrEncCert->cert.encryptedCert =
           PORT_ArenaZNew(poolp, CRMFEncryptedValue);
       if (inCertOrEncCert->cert.encryptedCert == NULL) {
           rv = SECFailure;
           break;
       }
       rv = SEC_ASN1Decode(poolp, inCertOrEncCert->cert.encryptedCert, 
                         CMMFCertOrEncCertEncryptedCertTemplate, 
                         (const char*)inCertOrEncCert->derValue.data,
                         inCertOrEncCert->derValue.len);
       break;
    default:
        rv = SECFailure;
    }
    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

static CERTCertificate* cmmf_DecodeDERCertificate ( CERTCertDBHandle *  db,
SECItem *  derCert 
) [static]

Definition at line 166 of file asn1cmn.c.

{
    CERTCertificate *newCert;

    newCert = CERT_NewTempCertificate(db, derCert, NULL, PR_FALSE, PR_TRUE);
    return newCert;
}

Here is the caller graph for this function:

Definition at line 175 of file asn1cmn.c.

{
    CMMFCertOrEncCertChoice retChoice; 

    switch(der->data[0] & 0x0f) {
    case 0:
        retChoice = cmmfCertificate;
       break;
    case 1:
        retChoice = cmmfEncryptedCert;
       break;
    default:
        retChoice = cmmfNoCertOrEncCert;
       break;
    }
    return retChoice;
}

Here is the caller graph for this function:


Variable Documentation

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFCertifiedKeyPair)},
    { SEC_ASN1_INLINE, offsetof(CMMFCertifiedKeyPair, certOrEncCert),
      CMMFCertOrEncCertTemplate },
    { SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC | SEC_ASN1_POINTER | 0,
      offsetof(CMMFCertifiedKeyPair, privateKey),
      CRMFEncryptedValueTemplate},
    { SEC_ASN1_NO_STREAM | SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC | 
      SEC_ASN1_XTRN | 1,
      offsetof (CMMFCertifiedKeyPair, derPublicationInfo),
      SEC_ASN1_SUB(SEC_AnyTemplate) },
    { 0 }
}

Definition at line 63 of file asn1cmn.c.

Initial value:

Definition at line 114 of file asn1cmn.c.

Initial value:

Definition at line 107 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_ANY, offsetof(CMMFCertOrEncCert, derValue), NULL, 
      sizeof(CMMFCertOrEncCert)},
    { 0 }
}

Definition at line 57 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFCertRepContent)},
    { SEC_ASN1_CONSTRUCTED | SEC_ASN1_OPTIONAL |
      SEC_ASN1_CONTEXT_SPECIFIC | 1,
      offsetof(CMMFCertRepContent, caPubs),
      CMMFSequenceOfCertsTemplate },
    { SEC_ASN1_SEQUENCE_OF, offsetof(CMMFCertRepContent, response),
      CMMFCertResponseTemplate},
    { 0 }
}

Definition at line 121 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFCertResponse)},
    { SEC_ASN1_INTEGER, offsetof(CMMFCertResponse, certReqId)},
    { SEC_ASN1_INLINE, offsetof(CMMFCertResponse, status), 
      CMMFPKIStatusInfoTemplate},
    { SEC_ASN1_OPTIONAL | SEC_ASN1_POINTER, 
      offsetof(CMMFCertResponse, certifiedKeyPair),
      CMMFCertifiedKeyPairTemplate},
    { 0 }
}

Definition at line 46 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFChallenge)},
    { SEC_ASN1_POINTER | SEC_ASN1_OPTIONAL | SEC_ASN1_XTRN, 
      offsetof(CMMFChallenge, owf),
      SEC_ASN1_SUB(SECOID_AlgorithmIDTemplate) },
    { SEC_ASN1_OCTET_STRING, offsetof(CMMFChallenge, witness) },
    { SEC_ASN1_ANY, offsetof(CMMFChallenge, senderDER) },
    { SEC_ASN1_OCTET_STRING, offsetof(CMMFChallenge, key) },
    { SEC_ASN1_OCTET_STRING, offsetof(CMMFChallenge, challenge) },
    { 0 }
}

Definition at line 132 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFPKIStatusInfo)},
    { SEC_ASN1_INTEGER, offsetof(CMMFPKIStatusInfo, status)},
    { SEC_ASN1_OPTIONAL | SEC_ASN1_UTF8_STRING, 
      offsetof(CMMFPKIStatusInfo, statusString)},
    { SEC_ASN1_OPTIONAL | SEC_ASN1_BIT_STRING, 
      offsetof(CMMFPKIStatusInfo, failInfo)},
    { 0 }
}

Definition at line 77 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE_OF,offsetof(CMMFPOPODecKeyChallContent, challenges),
      CMMFChallengeTemplate, sizeof(CMMFPOPODecKeyChallContent) },
    { 0 }
}

Definition at line 144 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE_OF | SEC_ASN1_XTRN, 
      offsetof(CMMFPOPODecKeyRespContent, responses),
      SEC_ASN1_SUB(SEC_IntegerTemplate), 
      sizeof(CMMFPOPODecKeyRespContent)},
    { 0 }
}

Definition at line 99 of file asn1cmn.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE, 0, NULL, sizeof(CMMFRand)},
    { SEC_ASN1_INTEGER, offsetof(CMMFRand, integer)},
    { SEC_ASN1_OCTET_STRING, offsetof(CMMFRand, senderHash)},
    { 0 }
}

Definition at line 92 of file asn1cmn.c.

Initial value:

Definition at line 87 of file asn1cmn.c.