Back to index

lightning-sunbird  0.9+nobinonly
Functions | Variables
xconst.c File Reference
#include "prtypes.h"
#include "mcom_db.h"
#include "seccomon.h"
#include "secdert.h"
#include "secoidt.h"
#include "secasn1t.h"
#include "secasn1.h"
#include "cert.h"
#include "secder.h"
#include "prprf.h"
#include "xconst.h"
#include "genname.h"
#include "secerr.h"

Go to the source code of this file.

Functions

SECStatus CERT_EncodeSubjectKeyID (PRArenaPool *arena, char *value, int len, SECItem *encodedValue)
SECStatus CERT_EncodePrivateKeyUsagePeriod (PRArenaPool *arena, CERTPrivKeyUsagePeriod *pkup, SECItem *encodedValue)
CERTPrivKeyUsagePeriod * CERT_DecodePrivKeyUsagePeriodExtension (PLArenaPool *arena, SECItem *extnValue)
SECStatus CERT_EncodeIA5TypeExtension (PRArenaPool *arena, char *value, SECItem *encodedValue)
SECStatus CERT_EncodeAltNameExtension (PRArenaPool *arena, CERTGeneralName *value, SECItem *encodedValue)
CERTGeneralName * CERT_DecodeAltNameExtension (PRArenaPool *arena, SECItem *EncodedAltName)
SECStatus CERT_EncodeNameConstraintsExtension (PRArenaPool *arena, CERTNameConstraints *value, SECItem *encodedValue)
CERTNameConstraints * CERT_DecodeNameConstraintsExtension (PRArenaPool *arena, SECItem *encodedConstraints)
CERTAuthInfoAccess ** CERT_DecodeAuthInfoAccessExtension (PRArenaPool *arena, SECItem *encodedExtension)
SECStatus cert_EncodeAuthInfoAccessExtension (PRArenaPool *arena, CERTAuthInfoAccess **info, SECItem *dest)

Variables

static const SEC_ASN1Template CERTSubjectKeyIDTemplate []
static const SEC_ASN1Template CERTIA5TypeTemplate []
static const SEC_ASN1Template CERTPrivateKeyUsagePeriodTemplate []
const SEC_ASN1Template CERTAltNameTemplate []
const SEC_ASN1Template CERTAuthInfoAccessItemTemplate []
const SEC_ASN1Template CERTAuthInfoAccessTemplate []

Function Documentation

CERTGeneralName* CERT_DecodeAltNameExtension ( PRArenaPool arena,
SECItem *  EncodedAltName 
)

Definition at line 208 of file xconst.c.

{
    SECStatus              rv = SECSuccess;
    CERTAltNameEncodedContext  encodedContext;

    encodedContext.encodedGenName = NULL;
    PORT_Memset(&encodedContext, 0, sizeof(CERTAltNameEncodedContext));
    rv = SEC_ASN1DecodeItem (arena, &encodedContext, CERT_GeneralNamesTemplate,
                          EncodedAltName);
    if (rv == SECFailure) {
       goto loser;
    }
    if (encodedContext.encodedGenName && encodedContext.encodedGenName[0])
       return cert_DecodeGeneralNames(arena, encodedContext.encodedGenName);
    /* Extension contained an empty GeneralNames sequence */
    /* Treat as extension not found */
    PORT_SetError(SEC_ERROR_EXTENSION_NOT_FOUND);
loser:
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

CERTAuthInfoAccess** CERT_DecodeAuthInfoAccessExtension ( PRArenaPool arena,
SECItem *  encodedExtension 
)

Definition at line 251 of file xconst.c.

{
    CERTAuthInfoAccess **info = NULL;
    SECStatus rv;
    int i;

    rv = SEC_ASN1DecodeItem(arena, &info, CERTAuthInfoAccessTemplate, 
                         encodedExtension);
    if (rv != SECSuccess || info == NULL) {
       return NULL;
    }

    for (i = 0; info[i] != NULL; i++) {
       info[i]->location = CERT_DecodeGeneralName(arena,
                                             &(info[i]->derLocation),
                                             NULL);
    }
    return info;
}

Here is the call graph for this function:

Here is the caller graph for this function:

CERTNameConstraints* CERT_DecodeNameConstraintsExtension ( PRArenaPool arena,
SECItem *  encodedConstraints 
)

Definition at line 243 of file xconst.c.

{
    return cert_DecodeNameConstraints(arena, encodedConstraints);
}

Here is the call graph for this function:

Here is the caller graph for this function:

CERTPrivKeyUsagePeriod* CERT_DecodePrivKeyUsagePeriodExtension ( PLArenaPool arena,
SECItem *  extnValue 
)

Definition at line 137 of file xconst.c.

{
    SECStatus rv;
    CERTPrivKeyUsagePeriod *pPeriod;
    SECItem newExtnValue;

    /* allocate the certificate policies structure */
    pPeriod = PORT_ArenaZNew(arena, CERTPrivKeyUsagePeriod);
    if ( pPeriod == NULL ) {
       goto loser;
    }
    
    pPeriod->arena = arena;

    /* copy the DER into the arena, since Quick DER returns data that points
       into the DER input, which may get freed by the caller */
    rv = SECITEM_CopyItem(arena, &newExtnValue, extnValue);
    if ( rv != SECSuccess ) {
       goto loser;
    }

    rv = SEC_QuickDERDecodeItem(arena, pPeriod, 
                                CERTPrivateKeyUsagePeriodTemplate,
                             &newExtnValue);
    if ( rv != SECSuccess ) {
       goto loser;
    }
    return pPeriod;
    
loser:
    return NULL;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus CERT_EncodeAltNameExtension ( PRArenaPool arena,
CERTGeneralName *  value,
SECItem *  encodedValue 
)

Definition at line 193 of file xconst.c.

{
    SECItem                **encodedGenName;
    SECStatus              rv = SECSuccess;

    encodedGenName = cert_EncodeGeneralNames(arena, value);
    if (SEC_ASN1EncodeItem (arena, encodedValue, &encodedGenName,
                         CERT_GeneralNamesTemplate) == NULL) {
       rv = SECFailure;
    }

    return rv;
}

Here is the call graph for this function:

Here is the caller graph for this function:

SECStatus cert_EncodeAuthInfoAccessExtension ( PRArenaPool arena,
CERTAuthInfoAccess **  info,
SECItem *  dest 
)

Definition at line 273 of file xconst.c.

{
    SECItem *dummy;
    int i;

    PORT_Assert(info != NULL);
    PORT_Assert(dest != NULL);
    if (info == NULL || dest == NULL) {
       return SECFailure;
    }

    for (i = 0; info[i] != NULL; i++) {
       if (CERT_EncodeGeneralName(info[i]->location, &(info[i]->derLocation),
                               arena) == NULL)
           /* Note that this may leave some of the locations filled in. */
           return SECFailure;
    }
    dummy = SEC_ASN1EncodeItem(arena, dest, &info,
                            CERTAuthInfoAccessTemplate);
    if (dummy == NULL) {
       return SECFailure;
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CERT_EncodeIA5TypeExtension ( PRArenaPool arena,
char *  value,
SECItem *  encodedValue 
)

Definition at line 172 of file xconst.c.

{
    SECItem encodeContext;
    SECStatus rv = SECSuccess;


    PORT_Memset (&encodeContext, 0, sizeof (encodeContext));
    
    if (value != NULL) {
       encodeContext.data = (unsigned char *)value;
       encodeContext.len = strlen(value);
    }
    if (SEC_ASN1EncodeItem (arena, encodedValue, &encodeContext,
                         CERTIA5TypeTemplate) == NULL) {
       rv = SECFailure;
    }
    
    return(rv);
}

Here is the call graph for this function:

SECStatus CERT_EncodeNameConstraintsExtension ( PRArenaPool arena,
CERTNameConstraints *  value,
SECItem *  encodedValue 
)

Definition at line 231 of file xconst.c.

{
    SECStatus     rv = SECSuccess;
    
    rv = cert_EncodeNameConstraints(value, arena, encodedValue);
    return rv;
}

Here is the call graph for this function:

SECStatus CERT_EncodePrivateKeyUsagePeriod ( PRArenaPool arena,
CERTPrivKeyUsagePeriod *  pkup,
SECItem *  encodedValue 
)

Definition at line 123 of file xconst.c.

{
    SECStatus rv = SECSuccess;

    if (SEC_ASN1EncodeItem (arena, encodedValue, pkup,
                         CERTPrivateKeyUsagePeriodTemplate) == NULL) {
       rv = SECFailure;
    }
    return(rv);
}

Here is the call graph for this function:

SECStatus CERT_EncodeSubjectKeyID ( PRArenaPool arena,
char *  value,
int  len,
SECItem *  encodedValue 
)

Definition at line 101 of file xconst.c.

{
    SECItem encodeContext;
    SECStatus rv = SECSuccess;


    PORT_Memset (&encodeContext, 0, sizeof (encodeContext));
    
    if (value != NULL) {
       encodeContext.data = (unsigned char *)value;
       encodeContext.len = len;
    }
    if (SEC_ASN1EncodeItem (arena, encodedValue, &encodeContext,
                         CERTSubjectKeyIDTemplate) == NULL) {
       rv = SECFailure;
    }
    
    return(rv);
}

Here is the call graph for this function:

Here is the caller graph for this function:


Variable Documentation

Initial value:

Definition at line 80 of file xconst.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE,
      0, NULL, sizeof(CERTAuthInfoAccess) },
    { SEC_ASN1_OBJECT_ID,
      offsetof(CERTAuthInfoAccess, method) },
    { SEC_ASN1_ANY,
      offsetof(CERTAuthInfoAccess, derLocation) },
    { 0, }
}

Definition at line 85 of file xconst.c.

Initial value:

Definition at line 95 of file xconst.c.

Initial value:

Definition at line 62 of file xconst.c.

Initial value:
 {
    { SEC_ASN1_SEQUENCE,
      0, NULL, sizeof(CERTPrivKeyUsagePeriod) },
    { SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC  | 0,      
         offsetof(CERTPrivKeyUsagePeriod, notBefore), 
         SEC_GeneralizedTimeTemplate},
    { SEC_ASN1_OPTIONAL | SEC_ASN1_CONTEXT_SPECIFIC  | 1,
         offsetof(CERTPrivKeyUsagePeriod, notAfter), 
         SEC_GeneralizedTimeTemplate},
    { 0, } 
}

Definition at line 67 of file xconst.c.

Initial value:

Definition at line 57 of file xconst.c.