Back to index

lightning-sunbird  0.9+nobinonly
Functions
crmf.h File Reference
#include "seccomon.h"
#include "cert.h"
#include "crmft.h"
#include "secoid.h"
#include "secpkcs7.h"
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Functions

SEC_BEGIN_PROTOS SECStatus CRMF_EncodeCertReqMsg (CRMFCertReqMsg *inCertReqMsg, CRMFEncoderOutputCallback fn, void *arg)
SECStatus CRMF_EncodeCertRequest (CRMFCertRequest *inCertReq, CRMFEncoderOutputCallback fn, void *arg)
SECStatus CRMF_EncodeCertReqMessages (CRMFCertReqMsg **inCertReqMsgs, CRMFEncoderOutputCallback fn, void *arg)
CRMFCertReqMsg * CRMF_CreateCertReqMsg (void)
SECStatus CRMF_DestroyCertReqMsg (CRMFCertReqMsg *inCertReqMsg)
SECStatus CRMF_CertReqMsgSetCertRequest (CRMFCertReqMsg *inCertReqMsg, CRMFCertRequest *inCertReq)
CRMFCertRequest * CRMF_CreateCertRequest (PRUint32 inRequestID)
SECStatus CRMF_DestroyCertRequest (CRMFCertRequest *inCertReq)
CRMFCertExtension * CRMF_CreateCertExtension (SECOidTag id, PRBool isCritical, SECItem *data)
SECStatus CRMF_DestroyCertExtension (CRMFCertExtension *inExtension)
SECStatus CRMF_CertRequestSetTemplateField (CRMFCertRequest *inCertReq, CRMFCertTemplateField inTemplateField, void *data)
PRBool CRMF_CertRequestIsFieldPresent (CRMFCertRequest *inCertReq, CRMFCertTemplateField inTemplateField)
PRBool CRMF_CertRequestIsControlPresent (CRMFCertRequest *inCertReq, CRMFControlType inControlType)
SECStatus CRMF_CertRequestSetRegTokenControl (CRMFCertRequest *inCertReq, SECItem *value)
SECStatus CRMF_CertRequestSetAuthenticatorControl (CRMFCertRequest *inCertReq, SECItem *value)
CRMFEncryptedKey * CRMF_CreateEncryptedKeyWithEncryptedValue (SECKEYPrivateKey *inPrivKey, CERTCertificate *inCACert)
SECStatus CRMF_DestroyEncryptedKey (CRMFEncryptedKey *inEncrKey)
CRMFPKIArchiveOptions * CRMF_CreatePKIArchiveOptions (CRMFPKIArchiveOptionsType inType, void *data)
SECStatus CRMF_DestroyPKIArchiveOptions (CRMFPKIArchiveOptions *inArchOpt)
SECStatus CRMF_CertRequestSetPKIArchiveOptions (CRMFCertRequest *inCertReq, CRMFPKIArchiveOptions *inOptions)
CRMFPOPChoice CRMF_CertReqMsgGetPOPType (CRMFCertReqMsg *inCertReqMsg)
SECStatus CRMF_CertReqMsgSetRAVerifiedPOP (CRMFCertReqMsg *inCertReqMsg)
SECStatus CRMF_CertReqMsgSetSignaturePOP (CRMFCertReqMsg *inCertReqMsg, SECKEYPrivateKey *inPrivKey, SECKEYPublicKey *inPubKey, CERTCertificate *inCertForInput, CRMFMACPasswordCallback fn, void *arg)
SECStatus CRMF_CertReqMsgSetKeyEnciphermentPOP (CRMFCertReqMsg *inCertReqMsg, CRMFPOPOPrivKeyChoice inKeyChoice, CRMFSubseqMessOptions subseqMess, SECItem *encPrivKey)
SECStatus CRMF_CertReqMsgSetKeyAgreementPOP (CRMFCertReqMsg *inCertReqMsg, CRMFPOPOPrivKeyChoice inKeyChoice, CRMFSubseqMessOptions subseqMess, SECItem *encPrivKey)
CRMFCertReqMsg * CRMF_CreateCertReqMsgFromDER (const char *buf, long len)
CRMFCertReqMessages * CRMF_CreateCertReqMessagesFromDER (const char *buf, long len)
SECStatus CRMF_DestroyCertReqMessages (CRMFCertReqMessages *inCertReqMsgs)
int CRMF_CertReqMessagesGetNumMessages (CRMFCertReqMessages *inCertReqMsgs)
CRMFCertReqMsg * CRMF_CertReqMessagesGetCertReqMsgAtIndex (CRMFCertReqMessages *inReqMsgs, int index)
SECStatus CRMF_CertReqMsgGetID (CRMFCertReqMsg *inCertReqMsg, long *destID)
PRBool CRMF_DoesRequestHaveField (CRMFCertRequest *inCertReq, CRMFCertTemplateField inField)
CRMFCertRequest * CRMF_CertReqMsgGetCertRequest (CRMFCertReqMsg *inCertReqMsg)
SECStatus CRMF_CertRequestGetCertTemplateVersion (CRMFCertRequest *inCertReq, long *version)
SECStatus CRMF_CertRequestGetCertTemplateSerialNumber (CRMFCertRequest *inCertReq, long *serialNumber)
SECStatus CRMF_CertRequestGetCertTemplateSigningAlg (CRMFCertRequest *inCertReq, SECAlgorithmID *destAlg)
SECStatus CRMF_CertRequestGetCertTemplateIssuer (CRMFCertRequest *inCertReq, CERTName *destIssuer)
SECStatus CRMF_CertRequestGetCertTemplateValidity (CRMFCertRequest *inCertReq, CRMFGetValidity *destValidity)
SECStatus CRMF_DestroyGetValidity (CRMFGetValidity *inValidity)
SECStatus CRMF_CertRequestGetCertTemplateSubject (CRMFCertRequest *inCertReq, CERTName *destSubject)
SECStatus CRMF_CertRequestGetCertTemplatePublicKey (CRMFCertRequest *inCertReq, CERTSubjectPublicKeyInfo *destPublicKey)
SECStatus CRMF_CertRequestGetCertTemplateIssuerUID (CRMFCertRequest *inCertReq, SECItem *destIssuerUID)
SECStatus CRMF_GetCertTemplateSubjectUID (CRMFCertRequest *inCertReq, SECItem *destSubjectUID)
int CRMF_CertRequestGetNumberOfExtensions (CRMFCertRequest *inCertReq)
CRMFCertExtension * CRMF_CertRequestGetExtensionAtIndex (CRMFCertRequest *inCertReq, int index)
SECOidTag CRMF_CertExtensionGetOidTag (CRMFCertExtension *inExtension)
PRBool CRMF_CertExtensionGetIsCritical (CRMFCertExtension *inExt)
SECItem * CRMF_CertExtensionGetValue (CRMFCertExtension *inExtension)
SECStatus CRMF_CertReqMsgGetPOPOSigningKey (CRMFCertReqMsg *inCertReqMsg, CRMFPOPOSigningKey **destKey)
SECStatus CRMF_DestroyPOPOSigningKey (CRMFPOPOSigningKey *inKey)
SECAlgorithmID * CRMF_POPOSigningKeyGetAlgID (CRMFPOPOSigningKey *inSignKey)
SECItem * CRMF_POPOSigningKeyGetSignature (CRMFPOPOSigningKey *inSignKey)
SECItem * CRMF_POPOSigningKeyGetInput (CRMFPOPOSigningKey *inSignKey)
SECStatus CRMF_CertReqMsgGetPOPKeyEncipherment (CRMFCertReqMsg *inCertReqMsg, CRMFPOPOPrivKey **destKey)
SECStatus CRMF_CertReqMsgGetPOPKeyAgreement (CRMFCertReqMsg *inCertReqMsg, CRMFPOPOPrivKey **destKey)
SECStatus CRMF_DestroyPOPOPrivKey (CRMFPOPOPrivKey *inPrivKey)
CRMFPOPOPrivKeyChoice CRMF_POPOPrivKeyGetChoice (CRMFPOPOPrivKey *inKey)
SECStatus CRMF_POPOPrivKeyGetThisMessage (CRMFPOPOPrivKey *inKey, SECItem *destString)
SECStatus CRMF_POPOPrivKeyGetSubseqMess (CRMFPOPOPrivKey *inKey, CRMFSubseqMessOptions *destOpt)
SECStatus CRMF_POPOPrivKeyGetDHMAC (CRMFPOPOPrivKey *inKey, SECItem *destMAC)
int CRMF_CertRequestGetNumControls (CRMFCertRequest *inCertReq)
CRMFControl * CRMF_CertRequestGetControlAtIndex (CRMFCertRequest *inCertReq, int index)
SECStatus CRMF_DestroyControl (CRMFControl *inControl)
CRMFControlType CRMF_ControlGetControlType (CRMFControl *inControl)
SECItem * CRMF_ControlGetRegTokenControlValue (CRMFControl *inControl)
SECItem * CRMF_ControlGetAuthicatorControlValue (CRMFControl *inControl)
CRMFPKIArchiveOptions * CRMF_ControlGetPKIArchiveOptions (CRMFControl *inControl)
CRMFPKIArchiveOptionsType CRMF_PKIArchiveOptionsGetOptionType (CRMFPKIArchiveOptions *inOptions)
CRMFEncryptedKey * CRMF_PKIArchiveOptionsGetEncryptedPrivKey (CRMFPKIArchiveOptions *inOpts)
CRMFEncryptedKeyChoice CRMF_EncryptedKeyGetChoice (CRMFEncryptedKey *inEncrKey)
CRMFEncryptedValue * CRMF_EncryptedKeyGetEncryptedValue (CRMFEncryptedKey *inKey)
SECStatus CRMF_DestroyEncryptedValue (CRMFEncryptedValue *inEncrValue)
SECItem * CRMF_EncryptedValueGetEncValue (CRMFEncryptedValue *inEncValue)
SECAlgorithmID * CRMF_EncryptedValueGetIntendedAlg (CRMFEncryptedValue *inEncValue)
SECAlgorithmID * CRMF_EncryptedValueGetSymmAlg (CRMFEncryptedValue *inEncValue)
SECAlgorithmID * CRMF_EncryptedValueGetKeyAlg (CRMFEncryptedValue *inEncValue)
SECItem * CRMF_EncryptedValueGetValueHint (CRMFEncryptedValue *inEncValue)
SECItem * CRMF_EncryptedValueGetEncSymmKey (CRMFEncryptedValue *inEncValue)
SECItem * CRMF_PKIArchiveOptionsGetKeyGenParameters (CRMFPKIArchiveOptions *inOptions)
SECStatus CRMF_PKIArchiveOptionsGetArchiveRemGenPrivKey (CRMFPKIArchiveOptions *inOpt, PRBool *destVal)
CK_MECHANISM_TYPE CRMF_GetBestWrapPadMechanism (PK11SlotInfo *slot)
SECItem * CRMF_GetIVFromMechanism (CK_MECHANISM_TYPE mechType)

Function Documentation

PRBool CRMF_CertExtensionGetIsCritical ( CRMFCertExtension *  inExt)

Definition at line 415 of file crmfget.c.

{
    PORT_Assert(inExt != NULL);
    if (inExt == NULL) {
        return PR_FALSE;
    }
    return inExt->critical.data != NULL;
}
SECOidTag CRMF_CertExtensionGetOidTag ( CRMFCertExtension *  inExtension)

Definition at line 405 of file crmfget.c.

{
    PORT_Assert(inExtension != NULL);
    if (inExtension == NULL) {
        return SEC_OID_UNKNOWN;
    }
    return SECOID_FindOIDTag(&inExtension->id);
}

Here is the call graph for this function:

SECItem* CRMF_CertExtensionGetValue ( CRMFCertExtension *  inExtension)

Definition at line 425 of file crmfget.c.

{
    PORT_Assert(inExtension != NULL);
    if (inExtension == NULL) {
        return NULL;
    }
    
    return SECITEM_DupItem(&inExtension->value);
}

Here is the call graph for this function:

CRMFCertReqMsg* CRMF_CertReqMessagesGetCertReqMsgAtIndex ( CRMFCertReqMessages *  inReqMsgs,
int  index 
)

Definition at line 536 of file servget.c.

{
    int numMsgs;

    PORT_Assert(inReqMsgs != NULL && index >= 0);
    if (inReqMsgs == NULL) {
        return NULL;
    }
    numMsgs = CRMF_CertReqMessagesGetNumMessages(inReqMsgs);
    if (index < 0 || index >= numMsgs) {
        return NULL;
    }
    return crmf_copy_cert_req_msg(inReqMsgs->messages[index]);
}

Here is the call graph for this function:

int CRMF_CertReqMessagesGetNumMessages ( CRMFCertReqMessages *  inCertReqMsgs)

Definition at line 553 of file servget.c.

{
    int numMessages = 0;

    PORT_Assert(inCertReqMsgs != NULL);
    if (inCertReqMsgs == NULL) {
        return 0;
    }
    while (inCertReqMsgs->messages[numMessages] != NULL) {
        numMessages++;
    }
    return numMessages;
}
CRMFCertRequest* CRMF_CertReqMsgGetCertRequest ( CRMFCertReqMsg *  inCertReqMsg)

Definition at line 568 of file servget.c.

{
    PRArenaPool     *poolp      = NULL;
    CRMFCertRequest *newCertReq = NULL;

    PORT_Assert(inCertReqMsg != NULL);

    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        goto loser;
    }
    newCertReq = crmf_copy_cert_request(poolp, inCertReqMsg->certReq);
    if (newCertReq == NULL) {
        goto loser;
    }
    newCertReq->poolp = poolp;
    return newCertReq;
 loser:
    if (poolp != NULL) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgGetID ( CRMFCertReqMsg *  inCertReqMsg,
long destID 
)

Definition at line 593 of file servget.c.

{
    PORT_Assert(inCertReqMsg != NULL && destID != NULL);
    if (inCertReqMsg == NULL || inCertReqMsg->certReq == NULL) {
        return SECFailure;
    }
    return crmf_extract_long_from_item(&inCertReqMsg->certReq->certReqId, 
                                   destID);
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgGetPOPKeyAgreement ( CRMFCertReqMsg *  inCertReqMsg,
CRMFPOPOPrivKey **  destKey 
)

Definition at line 604 of file servget.c.

{
    PORT_Assert(inCertReqMsg != NULL && destKey != NULL);
    if (inCertReqMsg == NULL || destKey == NULL ||
       CRMF_CertReqMsgGetPOPType(inCertReqMsg) != crmfKeyAgreement) {
        return SECFailure;
    }
    *destKey = PORT_ZNew(CRMFPOPOPrivKey);
    if (*destKey == NULL) {
        return SECFailure;
    }
    return crmf_copy_popoprivkey(NULL,
                             &inCertReqMsg->pop->popChoice.keyAgreement,
                             *destKey);
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgGetPOPKeyEncipherment ( CRMFCertReqMsg *  inCertReqMsg,
CRMFPOPOPrivKey **  destKey 
)

Definition at line 622 of file servget.c.

{
    PORT_Assert(inCertReqMsg != NULL && destKey != NULL);
    if (inCertReqMsg == NULL || destKey == NULL ||
       CRMF_CertReqMsgGetPOPType(inCertReqMsg) != crmfKeyEncipherment) {
        return SECFailure;
    }
    *destKey = PORT_ZNew(CRMFPOPOPrivKey);
    if (destKey == NULL) {
       return SECFailure;
    }
    return crmf_copy_popoprivkey(NULL,
                             &inCertReqMsg->pop->popChoice.keyEncipherment,
                             *destKey);
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgGetPOPOSigningKey ( CRMFCertReqMsg *  inCertReqMsg,
CRMFPOPOSigningKey **  destKey 
)

Definition at line 640 of file servget.c.

{
    CRMFProofOfPossession *pop;
    PORT_Assert(inCertReqMsg != NULL);
    if (inCertReqMsg  == NULL) {
        return SECFailure;
    }
    pop = inCertReqMsg->pop;;
    if (pop->popUsed != crmfSignature) {
        return SECFailure;
    }
    *destKey = PORT_ZNew(CRMFPOPOSigningKey);
    if (*destKey == NULL) {
        return SECFailure;
    }
    return crmf_copy_poposigningkey(NULL,&pop->popChoice.signature, *destKey);
}

Here is the call graph for this function:

CRMFPOPChoice CRMF_CertReqMsgGetPOPType ( CRMFCertReqMsg *  inCertReqMsg)

Definition at line 45 of file crmfget.c.

{
    PORT_Assert(inCertReqMsg != NULL);
    if (inCertReqMsg != NULL && inCertReqMsg->pop != NULL) {
        return inCertReqMsg->pop->popUsed;
    }
    return crmfNoPOPChoice;
}
SECStatus CRMF_CertReqMsgSetCertRequest ( CRMFCertReqMsg *  inCertReqMsg,
CRMFCertRequest *  inCertReq 
)

Definition at line 504 of file crmfreq.c.

{
    PORT_Assert (inCertReqMsg != NULL && inCertReq != NULL);
    if (inCertReqMsg == NULL || inCertReq == NULL) {
        return SECFailure;
    }
    inCertReqMsg->certReq = crmf_copy_cert_request(inCertReqMsg->poolp,
                                             inCertReq);
    return (inCertReqMsg->certReq == NULL) ? SECFailure : SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgSetKeyAgreementPOP ( CRMFCertReqMsg *  inCertReqMsg,
CRMFPOPOPrivKeyChoice  inKeyChoice,
CRMFSubseqMessOptions  subseqMess,
SECItem *  encPrivKey 
)

Definition at line 604 of file crmfpop.c.

{
    SECStatus rv;

    PORT_Assert(inCertReqMsg != NULL && inCertReqMsg->pop == NULL);
    switch (inKeyChoice) {    
    case crmfThisMessage:
        rv = crmf_add_privkey_thismessage(inCertReqMsg, encPrivKey,
                                     crmfKeyAgreement);
       break;
    case crmfSubsequentMessage:
        rv = crmf_add_privkey_subseqmessage(inCertReqMsg, subseqMess, 
                                       crmfKeyAgreement);
       break;
    case crmfDHMAC:
        /* In this case encPrivKey should be the calculated dhMac
         * as specified in RFC 2511 */
        rv = crmf_add_privkey_dhmac(inCertReqMsg, encPrivKey,
                                    crmfKeyAgreement);
        break;
    default:
        rv = SECFailure;
    }
    return rv;
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgSetKeyEnciphermentPOP ( CRMFCertReqMsg *  inCertReqMsg,
CRMFPOPOPrivKeyChoice  inKeyChoice,
CRMFSubseqMessOptions  subseqMess,
SECItem *  encPrivKey 
)

Definition at line 576 of file crmfpop.c.

{
    SECStatus rv;

    PORT_Assert(inCertReqMsg != NULL && inCertReqMsg->pop == NULL);
    if (CRMF_CertReqMsgGetPOPType(inCertReqMsg) != crmfNoPOPChoice) {
        return SECFailure;
    }
    switch (inKeyChoice) {    
    case crmfThisMessage:
        rv = crmf_add_privkey_thismessage(inCertReqMsg, encPrivKey,
                                     crmfKeyEncipherment);
       break;
    case crmfSubsequentMessage:
        rv = crmf_add_privkey_subseqmessage(inCertReqMsg, subseqMess, 
                                       crmfKeyEncipherment);
        break;
    case crmfDHMAC:
    default:
        rv = SECFailure;
    }
    return rv;
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgSetRAVerifiedPOP ( CRMFCertReqMsg *  inCertReqMsg)

Definition at line 66 of file crmfpop.c.

{
    SECItem               *dummy;
    CRMFProofOfPossession *pop;
    PRArenaPool           *poolp;
    void                  *mark;

    PORT_Assert(inCertReqMsg != NULL && inCertReqMsg->pop == NULL);
    poolp = inCertReqMsg->poolp;
    mark = PORT_ArenaMark(poolp);
    if (CRMF_CertReqMsgGetPOPType(inCertReqMsg) != crmfNoPOPChoice) {
        return SECFailure;
    }
    pop = PORT_ArenaZNew(poolp, CRMFProofOfPossession);
    if (pop == NULL) {
        goto loser;
    }
    pop->popUsed = crmfRAVerified;
    pop->popChoice.raVerified.data = NULL;
    pop->popChoice.raVerified.len  = 0;
    inCertReqMsg->pop = pop;
    dummy = SEC_ASN1EncodeItem(poolp, &(inCertReqMsg->derPOP),
                            &(pop->popChoice.raVerified),
                            CRMFRAVerifiedTemplate);
    return SECSuccess;
 loser:
    PORT_ArenaRelease(poolp, mark);
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertReqMsgSetSignaturePOP ( CRMFCertReqMsg *  inCertReqMsg,
SECKEYPrivateKey *  inPrivKey,
SECKEYPublicKey *  inPubKey,
CERTCertificate *  inCertForInput,
CRMFMACPasswordCallback  fn,
void arg 
)

Definition at line 255 of file crmfpop.c.

{
    SECAlgorithmID  *algID;
    PRArenaPool     *poolp;
    SECItem          derTemp = {siBuffer, NULL, 0};
    void            *mark;
    SECStatus        rv;
    CRMFPOPOSigningKeyInput *signKeyInput = NULL;
    CRMFCertRequest         *certReq;
    CRMFProofOfPossession   *pop;
    struct crmfEncoderArg    encoderArg;

    PORT_Assert(inCertReqMsg != NULL && inCertReqMsg->certReq != NULL &&
              inCertReqMsg->pop == NULL);
    certReq = inCertReqMsg->certReq;
    if (CRMF_CertReqMsgGetPOPType(inCertReqMsg) != crmfNoPOPChoice || 
       !CRMF_DoesRequestHaveField(certReq, crmfPublicKey)) {
        return SECFailure;
    } 
    poolp = inCertReqMsg->poolp;
    mark = PORT_ArenaMark(poolp);
    algID = crmf_create_poposignkey_algid(poolp, inPubKey);

    if(!CRMF_DoesRequestHaveField(certReq,crmfSubject)) {
        signKeyInput = crmf_create_poposigningkeyinput(poolp, inCertForInput,
                                                 fn, arg);
       if (signKeyInput == NULL) {
           goto loser;
       }
    }

    pop = PORT_ArenaZNew(poolp, CRMFProofOfPossession);
    if (pop == NULL) {
        goto loser;
    }
    
    rv = crmf_create_poposignkey(poolp, inCertReqMsg, 
                             signKeyInput, inPrivKey, algID,
                             &(pop->popChoice.signature));
    if (rv != SECSuccess) {
        goto loser;
    }

    pop->popUsed = crmfSignature;
    pop->popChoice.signature.algorithmIdentifier = algID;
    inCertReqMsg->pop = pop;
  
    rv = crmf_init_encoder_callback_arg (&encoderArg, &derTemp);
    if (rv != SECSuccess) {
        goto loser;
    }
    rv = SEC_ASN1Encode(&pop->popChoice.signature, 
                     CRMFPOPOSigningKeyTemplate,
                     crmf_generic_encoder_callback, &encoderArg);
    if (rv != SECSuccess) {
        goto loser;
    }
    rv = SECITEM_CopyItem(poolp, &(inCertReqMsg->derPOP), &derTemp);
    if (rv != SECSuccess) {
        goto loser;
    }
    PORT_Free (derTemp.data);
    PORT_ArenaUnmark(poolp,mark);
    return SECSuccess;

 loser:
    PORT_ArenaRelease(poolp,mark);
    if (derTemp.data != NULL) {
        PORT_Free(derTemp.data);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateIssuer ( CRMFCertRequest *  inCertReq,
CERTName *  destIssuer 
)

Definition at line 683 of file servget.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfIssuer)) {
        return crmf_copy_name(destIssuer, 
                           inCertReq->certTemplate.issuer);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateIssuerUID ( CRMFCertRequest *  inCertReq,
SECItem *  destIssuerUID 
)

Definition at line 698 of file servget.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfIssuerUID)) {
        return crmf_make_bitstring_copy(NULL, destIssuerUID,
                                   &inCertReq->certTemplate.issuerUID);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplatePublicKey ( CRMFCertRequest *  inCertReq,
CERTSubjectPublicKeyInfo *  destPublicKey 
)

Definition at line 713 of file servget.c.

{
    PORT_Assert (inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfPublicKey)) {
        return SECKEY_CopySubjectPublicKeyInfo(NULL, destPublicKey,
                                   inCertReq->certTemplate.publicKey);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateSerialNumber ( CRMFCertRequest *  inCertReq,
long serialNumber 
)

Definition at line 728 of file servget.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfSerialNumber)) {
        return 
         crmf_extract_long_from_item(&inCertReq->certTemplate.serialNumber,
                                  serialNumber);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateSigningAlg ( CRMFCertRequest *  inCertReq,
SECAlgorithmID *  destAlg 
)

Definition at line 744 of file servget.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfSigningAlg)) {
        return SECOID_CopyAlgorithmID(NULL, destAlg, 
                                  inCertReq->certTemplate.signingAlg);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateSubject ( CRMFCertRequest *  inCertReq,
CERTName *  destSubject 
)

Definition at line 759 of file servget.c.

{
  PORT_Assert(inCertReq != NULL);
  if (inCertReq == NULL) {
      return SECFailure;
  }
  if (CRMF_DoesRequestHaveField(inCertReq, crmfSubject)) {
      return crmf_copy_name(destSubject, inCertReq->certTemplate.subject);
  }
  return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateValidity ( CRMFCertRequest *  inCertReq,
CRMFGetValidity *  destValidity 
)

Definition at line 827 of file servget.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfValidity)) {
        return crmf_copy_validity(destValidity, 
                              inCertReq->certTemplate.validity);
    }
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestGetCertTemplateVersion ( CRMFCertRequest *  inCertReq,
long version 
)

Definition at line 788 of file servget.c.

{
    PORT_Assert (inCertReq != NULL);
    if (inCertReq == NULL) {
        return SECFailure;
    }
    if (CRMF_DoesRequestHaveField(inCertReq, crmfVersion)) {
        return crmf_extract_long_from_item(&inCertReq->certTemplate.version,
                                      version);
    } 
    return SECFailure;
}

Here is the call graph for this function:

CRMFControl* CRMF_CertRequestGetControlAtIndex ( CRMFCertRequest *  inCertReq,
int  index 
)

Definition at line 842 of file servget.c.

{
    CRMFControl *newControl, *srcControl;
    int          numControls;
    SECStatus    rv;

    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return NULL;
    }
    numControls = CRMF_CertRequestGetNumControls(inCertReq);
    if (index >= numControls || index < 0) {
        return NULL;
    }
    newControl = PORT_ZNew(CRMFControl);
    if (newControl == NULL) {
        return NULL;
    }
    srcControl = inCertReq->controls[index];
    newControl->tag = srcControl->tag;
    rv = SECITEM_CopyItem (NULL, &newControl->derTag, &srcControl->derTag);
    if (rv != SECSuccess) {
        goto loser;
    }

    rv = SECITEM_CopyItem(NULL, &newControl->derValue, 
                       &srcControl->derValue);
    if (rv != SECSuccess) {
        goto loser;
    }
    /* Copy over the PKIArchiveOptions stuff */
    switch (srcControl->tag) {
    case SEC_OID_PKIX_REGCTRL_REGTOKEN:
    case SEC_OID_PKIX_REGCTRL_AUTHENTICATOR:
        /* No further processing necessary for these types. */
        rv = SECSuccess;
       break;
    case SEC_OID_PKIX_REGCTRL_OLD_CERT_ID:
    case SEC_OID_PKIX_REGCTRL_PKIPUBINFO:
    case SEC_OID_PKIX_REGCTRL_PROTOCOL_ENC_KEY:
        /* These aren't supported yet, so no post-processing will
        * be done at this time.  But we don't want to fail in case
        * we read in DER that has one of these options.
        */
        rv = SECSuccess;
       break;
    case SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS:
        rv = crmf_copy_pkiarchiveoptions(NULL, 
                                    &newControl->value.archiveOptions,
                                    &srcControl->value.archiveOptions);
       break;
    default:
        rv = SECFailure;
    }
    if (rv != SECSuccess) {
        goto loser;
    }
    return newControl;
 loser:
    if (newControl != NULL) {
        CRMF_DestroyControl(newControl);
    }
    return NULL;
}

Here is the call graph for this function:

CRMFCertExtension* CRMF_CertRequestGetExtensionAtIndex ( CRMFCertRequest *  inCertReq,
int  index 
)

Definition at line 995 of file servget.c.

{
    int numExtensions;

    PORT_Assert(inCertReq != NULL);
    numExtensions = CRMF_CertRequestGetNumberOfExtensions(inCertReq);
    if (index >= numExtensions || index < 0) {
        return NULL;
    }
    return 
      crmf_copy_cert_extension(NULL, 
                            inCertReq->certTemplate.extensions[index]);
}

Here is the call graph for this function:

int CRMF_CertRequestGetNumberOfExtensions ( CRMFCertRequest *  inCertReq)

Definition at line 391 of file crmfget.c.

{
    CRMFCertTemplate *certTemplate;
    int count = 0;
    
    certTemplate = &inCertReq->certTemplate;
    if (certTemplate->extensions) {
        while (certTemplate->extensions[count] != NULL)
           count++;
    }
    return count;
}
int CRMF_CertRequestGetNumControls ( CRMFCertRequest *  inCertReq)

Definition at line 467 of file crmfget.c.

{
    int              count = 0;

    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return 0;
    }
    if (inCertReq->controls) {
        while (inCertReq->controls[count] != NULL)
           count++;
    }
    return count;
}
PRBool CRMF_CertRequestIsControlPresent ( CRMFCertRequest *  inCertReq,
CRMFControlType  inControlType 
)

Definition at line 1172 of file crmfcont.c.

{
    SECOidTag controlTag;
    int       i;

    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL || inCertReq->controls == NULL) {
        return PR_FALSE;
    }
    controlTag = crmf_controltype_to_tag(inControlType);
    for (i=0; inCertReq->controls[i] != NULL; i++) {
        if (inCertReq->controls[i]->tag == controlTag) {
           return PR_TRUE;
       }
    }
    return PR_FALSE;
}

Here is the call graph for this function:

PRBool CRMF_CertRequestIsFieldPresent ( CRMFCertRequest *  inCertReq,
CRMFCertTemplateField  inTemplateField 
)

Definition at line 653 of file crmfreq.c.

{
    PRBool             retVal;
    CRMFCertTemplate *certTemplate;

    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        /* This is probably some kind of error, but this is 
        * the safest return value for this function.
        */
        return PR_FALSE;
    }
    certTemplate = &inCertReq->certTemplate;
    switch (inTemplateField) {
    case crmfVersion:
      retVal = crmf_item_has_data(&certTemplate->version);
      break;
    case crmfSerialNumber:
      retVal = crmf_item_has_data(&certTemplate->serialNumber);
      break;
    case crmfSigningAlg:
      retVal = IS_NOT_NULL(certTemplate->signingAlg);
      break;
    case crmfIssuer:
      retVal = IS_NOT_NULL(certTemplate->issuer);
      break;
    case crmfValidity:
      retVal = IS_NOT_NULL(certTemplate->validity);
      break;
    case crmfSubject:
      retVal = IS_NOT_NULL(certTemplate->subject);
      break;
    case crmfPublicKey:
      retVal = IS_NOT_NULL(certTemplate->publicKey);
      break;
    case crmfIssuerUID:
      retVal = crmf_item_has_data(&certTemplate->issuerUID);
      break;
    case crmfSubjectUID:
      retVal = crmf_item_has_data(&certTemplate->subjectUID);
      break;
    case crmfExtension:
      retVal = IS_NOT_NULL(certTemplate->extensions);
      break;
    default:
      retVal = PR_FALSE;
    }
    return retVal;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestSetAuthenticatorControl ( CRMFCertRequest *  inCertReq,
SECItem *  value 
)

Definition at line 138 of file crmfcont.c.

Here is the call graph for this function:

SECStatus CRMF_CertRequestSetPKIArchiveOptions ( CRMFCertRequest *  inCertReq,
CRMFPKIArchiveOptions *  inOptions 
)

Definition at line 1065 of file crmfcont.c.

{
    CRMFControl *newControl;
    PRArenaPool *poolp;
    SECStatus    rv;
    void        *mark;
    
    PORT_Assert(inCertReq != NULL && inOptions != NULL);
    if (inCertReq == NULL || inOptions == NULL) {
        return SECFailure;
    }
    poolp = inCertReq->poolp;
    mark = PORT_ArenaMark(poolp);
    rv = crmf_add_new_control(inCertReq, 
                           SEC_OID_PKIX_REGCTRL_PKI_ARCH_OPTIONS,
                           &newControl);
    if (rv != SECSuccess) {
        goto loser;
    }

    rv = crmf_copy_pkiarchiveoptions(poolp, 
                                 &newControl->value.archiveOptions,
                                 inOptions);
    if (rv != SECSuccess) {
        goto loser;
    }

    rv = crmf_encode_pkiarchiveoptions(poolp, newControl); 
    if (rv != SECSuccess) {
        goto loser;
    }
    PORT_ArenaUnmark(poolp, mark);
    return SECSuccess;
 loser:
    PORT_ArenaRelease(poolp, mark);
    return SECFailure;
}

Here is the call graph for this function:

SECStatus CRMF_CertRequestSetRegTokenControl ( CRMFCertRequest *  inCertReq,
SECItem *  value 
)

Definition at line 131 of file crmfcont.c.

Here is the call graph for this function:

SECStatus CRMF_CertRequestSetTemplateField ( CRMFCertRequest *  inCertReq,
CRMFCertTemplateField  inTemplateField,
void data 
)

Definition at line 434 of file crmfreq.c.

{
    CRMFCertTemplate *certTemplate;
    PRArenaPool      *poolp;
    SECStatus         rv = SECFailure;
    void             *mark;
    

    if (inCertReq == NULL) {
        return SECFailure;
    }

    certTemplate = &(inCertReq->certTemplate);

    poolp = inCertReq->poolp;
    mark = PORT_ArenaMark(poolp);
    switch (inTemplateField) {
    case crmfVersion:
      rv = crmf_template_add_version(poolp,&(certTemplate->version), 
                                 *(long*)data);
      break;
    case crmfSerialNumber:
      rv = crmf_template_add_serialnumber(poolp, 
                                     &(certTemplate->serialNumber),
                                     *(long*)data);
      break;
    case crmfSigningAlg:
      rv = crmf_template_copy_secalg (poolp, &(certTemplate->signingAlg),
                                  (SECAlgorithmID*)data);
      break;
    case crmfIssuer:
      rv = crmf_template_add_issuer (poolp, &(certTemplate->issuer), 
                                 (CERTName*)data);
      break;
    case crmfValidity:
      rv = crmf_template_add_validity (poolp, &(certTemplate->validity),
                                   (CRMFValidityCreationInfo*)data);
      break;
    case crmfSubject:
      rv = crmf_template_add_subject (poolp, &(certTemplate->subject),
                                  (CERTName*)data);
      break;
    case crmfPublicKey:
      rv = crmf_template_add_public_key(poolp, &(certTemplate->publicKey),
                                   (CERTSubjectPublicKeyInfo*)data);
      break;
    case crmfIssuerUID:
      rv = crmf_template_add_issuer_uid(poolp, &(certTemplate->issuerUID),
                                   (SECItem*)data);
      break;
    case crmfSubjectUID:
      rv = crmf_template_add_subject_uid(poolp, &(certTemplate->subjectUID),
                                    (SECItem*)data);
      break;
    case crmfExtension:
      rv = crmf_template_add_extensions(poolp, certTemplate, 
                                   (CRMFCertExtCreationInfo*)data);
      break;
    }
    if (rv != SECSuccess) {
        PORT_ArenaRelease(poolp, mark);
    } else {
        PORT_ArenaUnmark(poolp, mark);
    }
    return rv;
}

Here is the call graph for this function:

SECItem* CRMF_ControlGetAuthicatorControlValue ( CRMFControl *  inControl)
CRMFControlType CRMF_ControlGetControlType ( CRMFControl *  inControl)

Definition at line 925 of file servget.c.

CRMFPKIArchiveOptions* CRMF_ControlGetPKIArchiveOptions ( CRMFControl *  inControl)

Definition at line 956 of file servget.c.

{
    CRMFPKIArchiveOptions *newOpt = NULL;
    SECStatus rv;

    PORT_Assert(inControl != NULL);
    if (inControl == NULL ||
       CRMF_ControlGetControlType(inControl) != crmfPKIArchiveOptionsControl){
        goto loser;
    }
    newOpt = PORT_ZNew(CRMFPKIArchiveOptions);
    if (newOpt == NULL) {
        goto loser;
    }
    rv = crmf_copy_pkiarchiveoptions(NULL, newOpt, 
                                 &inControl->value.archiveOptions);
    if (rv != SECSuccess) {
        goto loser;
    }

 loser:
    if (newOpt != NULL) {
        CRMF_DestroyPKIArchiveOptions(newOpt);
    }
    return NULL;
}

Here is the call graph for this function:

SECItem* CRMF_ControlGetRegTokenControlValue ( CRMFControl *  inControl)

Definition at line 984 of file servget.c.

{
    PORT_Assert(inControl != NULL);
    if (inControl == NULL ||
       CRMF_ControlGetControlType(inControl) != crmfRegTokenControl) {
        return NULL;
    }
    return crmf_copy_control_value(inControl);;
}

Here is the call graph for this function:

CRMFCertExtension* CRMF_CreateCertExtension ( SECOidTag  id,
PRBool  isCritical,
SECItem *  data 
)

Definition at line 606 of file crmfreq.c.

{
    return crmf_create_cert_extension(NULL, id, isCritical, data);
}

Here is the call graph for this function:

CRMFCertReqMessages* CRMF_CreateCertReqMessagesFromDER ( const char *  buf,
long  len 
)

Definition at line 350 of file crmfdec.c.

{
    long                 arenaSize;
    int                  i;
    SECStatus            rv;
    PRArenaPool         *poolp;
    CRMFCertReqMessages *certReqMsgs;

    PORT_Assert (buf != NULL);
    /* Wanna make sure the arena is big enough to store all of the requests
     * coming in.  We'll guestimate according to the length of the buffer.
     */
    arenaSize = len + len/2;
    poolp = PORT_NewArena(arenaSize);
    if (poolp == NULL) {
        return NULL;
    }
    certReqMsgs = PORT_ArenaZNew(poolp, CRMFCertReqMessages);
    if (certReqMsgs == NULL) {
        goto loser;
    }
    certReqMsgs->poolp = poolp;
    rv = SEC_ASN1Decode(poolp, certReqMsgs, CRMFCertReqMessagesTemplate,
                     buf, len);
    if (rv != SECSuccess) {
        goto loser;
    }
    for (i=0; certReqMsgs->messages[i] != NULL; i++) {
        /* The sub-routines expect the individual messages to have 
        * an arena.  We'll give them one temporarily.
        */
        certReqMsgs->messages[i]->poolp = poolp;
        rv = crmf_decode_process_single_reqmsg(certReqMsgs->messages[i]);
       if (rv != SECSuccess) {
           goto loser;
       }
        certReqMsgs->messages[i]->poolp = NULL;
    }
    return certReqMsgs;

 loser:
    PORT_FreeArena(poolp, PR_FALSE);
    return NULL;
}

Here is the call graph for this function:

CRMFCertReqMsg* CRMF_CreateCertReqMsg ( void  )

Definition at line 517 of file crmfreq.c.

{
    PRArenaPool    *poolp;
    CRMFCertReqMsg *reqMsg;

    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        goto loser;
    }
    reqMsg = PORT_ArenaZNew(poolp, CRMFCertReqMsg);
    if (reqMsg == NULL) {
        goto loser;
    }
    reqMsg->poolp = poolp;
    return reqMsg;
    
 loser:
    if (poolp) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}

Here is the call graph for this function:

CRMFCertReqMsg* CRMF_CreateCertReqMsgFromDER ( const char *  buf,
long  len 
)

Definition at line 316 of file crmfdec.c.

{
    PRArenaPool    *poolp;
    CRMFCertReqMsg *certReqMsg;
    SECStatus       rv;

    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        goto loser;
    }
    certReqMsg = PORT_ArenaZNew (poolp, CRMFCertReqMsg);
    if (certReqMsg == NULL) {
        goto loser;
    }
    certReqMsg->poolp = poolp;
    rv = SEC_ASN1Decode(poolp, certReqMsg, CRMFCertReqMsgTemplate, buf, len);
    if (rv != SECSuccess) {
        goto loser;
    }

    rv = crmf_decode_process_single_reqmsg(certReqMsg);
    if (rv != SECSuccess) {
        goto loser;
    }

    return certReqMsg;
 loser:
    if (poolp != NULL) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}

Here is the call graph for this function:

CRMFCertRequest* CRMF_CreateCertRequest ( PRUint32  inRequestID)

Definition at line 121 of file crmfreq.c.

{
    PRArenaPool     *poolp;
    CRMFCertRequest *certReq;
    SECStatus        rv;
    
    poolp = PORT_NewArena(CRMF_DEFAULT_ARENA_SIZE);
    if (poolp == NULL) {
        goto loser;
    }
    
    certReq=PORT_ArenaZNew(poolp,CRMFCertRequest);
    if (certReq == NULL) {
        goto loser;
    }

    certReq->poolp = poolp;
    certReq->requestID = inRequestID;
    
    rv = crmf_encode_unsigned_integer(poolp, &(certReq->certReqId), 
                                      inRequestID);
    if (rv != SECSuccess) {
        goto loser;
    }

    return certReq;
 loser:
    if (poolp) {
        PORT_FreeArena(poolp, PR_FALSE);
    }
    return NULL;
}

Here is the call graph for this function:

CRMFEncryptedKey* CRMF_CreateEncryptedKeyWithEncryptedValue ( SECKEYPrivateKey *  inPrivKey,
CERTCertificate *  inCACert 
)

Definition at line 887 of file crmfcont.c.

{
    SECKEYPublicKey          *caPubKey = NULL;
    CRMFEncryptedKey         *encKey = NULL;
    CRMFEncryptedValue       *dummy;

    PORT_Assert(inPrivKey != NULL && inCACert != NULL);
    if (inPrivKey == NULL || inCACert == NULL) {
        return NULL;
    }

    caPubKey = CERT_ExtractPublicKey(inCACert);
    if (caPubKey == NULL) {
        goto loser;
    }

    encKey = PORT_ZNew(CRMFEncryptedKey);
    if (encKey == NULL) {
        goto loser;
    }
    dummy = crmf_create_encrypted_value_wrapped_privkey(inPrivKey,
                                                 caPubKey,
                                          &encKey->value.encryptedValue);
    PORT_Assert(dummy == &encKey->value.encryptedValue);
    /* We won't add the der value here, but rather when it 
     * becomes part of a certificate request.
     */
    SECKEY_DestroyPublicKey(caPubKey);
    encKey->encKeyChoice = crmfEncryptedValueChoice;
    return encKey;
 loser:
    if (encKey != NULL) {
        CRMF_DestroyEncryptedKey(encKey);
    }
    if (caPubKey != NULL) {
        SECKEY_DestroyPublicKey(caPubKey);
    }
    return NULL;
}

Here is the call graph for this function:

CRMFPKIArchiveOptions* CRMF_CreatePKIArchiveOptions ( CRMFPKIArchiveOptionsType  inType,
void data 
)

Definition at line 398 of file crmfcont.c.

{
    CRMFPKIArchiveOptions* retOptions;

    PORT_Assert(data != NULL);
    if (data == NULL) {
        return NULL;
    }
    switch(inType) {
    case crmfEncryptedPrivateKey:
        retOptions = crmf_create_encr_pivkey_option((CRMFEncryptedKey*)data);
       break;
    case crmfKeyGenParameters:
        retOptions = crmf_create_keygen_param_option((SECItem*)data);
       break;
    case crmfArchiveRemGenPrivKey:
        retOptions = crmf_create_arch_rem_gen_privkey(*(PRBool*)data);
       break;
    default:
        retOptions = NULL;
    }
    return retOptions;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyCertExtension ( CRMFCertExtension *  inExtension)

Definition at line 628 of file crmfreq.c.

{
    return crmf_destroy_cert_extension(inExtension, PR_TRUE);
}

Here is the call graph for this function:

SECStatus CRMF_DestroyCertReqMessages ( CRMFCertReqMessages *  inCertReqMsgs)

Definition at line 634 of file crmfreq.c.

{
    PORT_Assert (inCertReqMsgs != NULL);
    if (inCertReqMsgs != NULL) {
        PORT_FreeArena(inCertReqMsgs->poolp, PR_TRUE);
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyCertReqMsg ( CRMFCertReqMsg *  inCertReqMsg)

Definition at line 541 of file crmfreq.c.

{
    PORT_Assert(inCertReqMsg != NULL && inCertReqMsg->poolp != NULL);
    if (!inCertReqMsg->isDecoded) {
        if (inCertReqMsg->certReq->certTemplate.extensions != NULL) {
           PORT_Free(inCertReqMsg->certReq->certTemplate.extensions);
       }
       if (inCertReqMsg->certReq->controls != NULL) {
           PORT_Free(inCertReqMsg->certReq->controls);
       }
    }
    PORT_FreeArena(inCertReqMsg->poolp, PR_TRUE);
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyCertRequest ( CRMFCertRequest *  inCertReq)

Definition at line 155 of file crmfreq.c.

{
    PORT_Assert(inCertReq != NULL);
    if (inCertReq != NULL) {
        if (inCertReq->certTemplate.extensions) {
           PORT_Free(inCertReq->certTemplate.extensions);
       }
       if (inCertReq->controls) {
           /* Right now we don't support EnveloppedData option,
            * so we won't go through and delete each occurrence of 
            * an EnveloppedData in the control.
            */
           PORT_Free(inCertReq->controls);
       }
       if (inCertReq->poolp) {
           PORT_FreeArena(inCertReq->poolp, PR_TRUE);
       }
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyControl ( CRMFControl *  inControl)

Definition at line 1135 of file crmfcont.c.

{
    return crmf_destroy_control(inControl, PR_TRUE);
}

Here is the call graph for this function:

SECStatus CRMF_DestroyEncryptedKey ( CRMFEncryptedKey *  inEncrKey)

Definition at line 929 of file crmfcont.c.

{
    return crmf_destroy_encrypted_key(inEncrKey, PR_TRUE);
}

Here is the call graph for this function:

SECStatus CRMF_DestroyEncryptedValue ( CRMFEncryptedValue *  inEncrValue)

Definition at line 181 of file crmfcont.c.

{
    return crmf_destroy_encrypted_value(inEncrValue, PR_TRUE);
}

Here is the call graph for this function:

SECStatus CRMF_DestroyGetValidity ( CRMFGetValidity *  inValidity)

Definition at line 355 of file crmfget.c.

{
    PORT_Assert(inValidity != NULL);
    if (inValidity != NULL) {
        if (inValidity->notAfter) {
           PORT_Free(inValidity->notAfter);
           inValidity->notAfter = NULL;
       }
       if (inValidity->notBefore) {
           PORT_Free(inValidity->notBefore);
           inValidity->notBefore = NULL;
       }
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyPKIArchiveOptions ( CRMFPKIArchiveOptions *  inArchOpt)

Definition at line 475 of file crmfcont.c.

{
    return crmf_destroy_pkiarchiveoptions(inArchOptions, PR_TRUE);
}

Here is the call graph for this function:

SECStatus CRMF_DestroyPOPOPrivKey ( CRMFPOPOPrivKey *  inPrivKey)

Definition at line 456 of file crmfget.c.

{
    PORT_Assert(inPrivKey != NULL);
    if (inPrivKey != NULL) {
        SECITEM_FreeItem(&inPrivKey->message.thisMessage, PR_FALSE);
       PORT_Free(inPrivKey);
    }
    return SECSuccess;
}

Here is the call graph for this function:

SECStatus CRMF_DestroyPOPOSigningKey ( CRMFPOPOSigningKey *  inKey)

Definition at line 437 of file crmfget.c.

{
    PORT_Assert(inKey != NULL);
    if (inKey != NULL) {
        if (inKey->derInput.data != NULL) {
           SECITEM_FreeItem(&inKey->derInput, PR_FALSE);
       }
       if (inKey->algorithmIdentifier != NULL) {
           SECOID_DestroyAlgorithmID(inKey->algorithmIdentifier, PR_TRUE);
       }
       if (inKey->signature.data != NULL) {
           SECITEM_FreeItem(&inKey->signature, PR_FALSE);
       }
       PORT_Free(inKey);
    }
    return SECSuccess;
}

Here is the call graph for this function:

PRBool CRMF_DoesRequestHaveField ( CRMFCertRequest *  inCertReq,
CRMFCertTemplateField  inField 
)

Definition at line 87 of file crmfreq.c.

{
  
    PORT_Assert(inCertReq != NULL);
    if (inCertReq == NULL) {
        return PR_FALSE;
    }
    switch (inField) {
    case crmfVersion:
        return inCertReq->certTemplate.version.data != NULL;
    case crmfSerialNumber:
        return inCertReq->certTemplate.serialNumber.data != NULL;
    case crmfSigningAlg:
        return inCertReq->certTemplate.signingAlg != NULL;
    case crmfIssuer:
        return inCertReq->certTemplate.issuer != NULL;
    case crmfValidity:
        return inCertReq->certTemplate.validity != NULL;
    case crmfSubject:
        return inCertReq->certTemplate.subject != NULL;
    case crmfPublicKey:
        return inCertReq->certTemplate.publicKey != NULL;
    case crmfIssuerUID:
        return inCertReq->certTemplate.issuerUID.data != NULL;
    case crmfSubjectUID:
        return inCertReq->certTemplate.subjectUID.data != NULL;
    case crmfExtension:
        return CRMF_CertRequestGetNumberOfExtensions(inCertReq) != 0;
    }
    return PR_FALSE;
}

Here is the call graph for this function:

SECStatus CRMF_EncodeCertReqMessages ( CRMFCertReqMsg **  inCertReqMsgs,
CRMFEncoderOutputCallback  fn,
void arg 
)

Definition at line 71 of file crmfenc.c.

{
    struct crmfEncoderOutput output;
    CRMFCertReqMessages msgs;
    
    output.fn        = fn;
    output.outputArg = arg;
    msgs.messages = inCertReqMsgs;
    return SEC_ASN1Encode(&msgs, CRMFCertReqMessagesTemplate,
                       crmf_encoder_out, &output);
}

Here is the call graph for this function:

SEC_BEGIN_PROTOS SECStatus CRMF_EncodeCertReqMsg ( CRMFCertReqMsg *  inCertReqMsg,
CRMFEncoderOutputCallback  fn,
void arg 
)

Definition at line 43 of file crmfenc.c.

{
    struct crmfEncoderOutput output;

    output.fn        = fn;
    output.outputArg = arg;
    return SEC_ASN1Encode(inCertReqMsg,CRMFCertReqMsgTemplate, 
                       crmf_encoder_out, &output);
    
}

Here is the call graph for this function:

SECStatus CRMF_EncodeCertRequest ( CRMFCertRequest *  inCertReq,
CRMFEncoderOutputCallback  fn,
void arg 
)

Definition at line 58 of file crmfenc.c.

Here is the call graph for this function:

CRMFEncryptedKeyChoice CRMF_EncryptedKeyGetChoice ( CRMFEncryptedKey *  inEncrKey)

Definition at line 46 of file servget.c.

{
    PORT_Assert(inEncrKey != NULL);
    if (inEncrKey == NULL) {
        return crmfNoEncryptedKeyChoice;
    }
    return inEncrKey->encKeyChoice;
}
CRMFEncryptedValue* CRMF_EncryptedKeyGetEncryptedValue ( CRMFEncryptedKey *  inKey)

Definition at line 56 of file servget.c.

{
    CRMFEncryptedValue *newEncrValue = NULL;
    SECStatus           rv;

    PORT_Assert(inEncrKey != NULL);
    if (inEncrKey == NULL ||
       CRMF_EncryptedKeyGetChoice(inEncrKey) != crmfEncryptedValueChoice) {
        goto loser;
    }
    newEncrValue = PORT_ZNew(CRMFEncryptedValue);
    if (newEncrValue == NULL) {
        goto loser;
    }
    rv = crmf_copy_encryptedvalue(NULL, &inEncrKey->value.encryptedValue,
                              newEncrValue);
    if (rv != SECSuccess) {
        goto loser;
    }
    return newEncrValue;
 loser:
    if (newEncrValue != NULL) {
        CRMF_DestroyEncryptedValue(newEncrValue);
    }
    return NULL;
}

Here is the call graph for this function:

SECItem* CRMF_EncryptedValueGetEncSymmKey ( CRMFEncryptedValue *  inEncValue)

Definition at line 109 of file servget.c.

{
    if (inEncValue == NULL) {
        return NULL;
    }
    return crmf_get_encvalue_bitstring(&inEncValue->encSymmKey);
}

Here is the call graph for this function:

SECItem* CRMF_EncryptedValueGetEncValue ( CRMFEncryptedValue *  inEncValue)

Definition at line 118 of file servget.c.

{
    if (inEncrValue == NULL || inEncrValue->encValue.data == NULL) {
        return NULL;
    }
    return crmf_get_encvalue_bitstring(&inEncrValue->encValue);
}

Here is the call graph for this function:

SECAlgorithmID* CRMF_EncryptedValueGetIntendedAlg ( CRMFEncryptedValue *  inEncValue)

Definition at line 143 of file servget.c.

{
    if (inEncValue == NULL) {
        return NULL;
    }
    return crmf_get_encvalue_algid(inEncValue->intendedAlg);
}

Here is the call graph for this function:

SECAlgorithmID* CRMF_EncryptedValueGetKeyAlg ( CRMFEncryptedValue *  inEncValue)

Definition at line 152 of file servget.c.

{
    if (inEncValue == NULL) {
        return NULL;
    }
    return crmf_get_encvalue_algid(inEncValue->keyAlg);
}

Here is the call graph for this function:

SECAlgorithmID* CRMF_EncryptedValueGetSymmAlg ( CRMFEncryptedValue *  inEncValue)

Definition at line 161 of file servget.c.

{
    if (inEncValue == NULL) {
        return NULL;
    }
    return crmf_get_encvalue_algid(inEncValue->symmAlg);
}

Here is the call graph for this function:

SECItem* CRMF_EncryptedValueGetValueHint ( CRMFEncryptedValue *  inEncValue)

Definition at line 170 of file servget.c.

{
    if (inEncValue == NULL || inEncValue->valueHint.data == NULL) {
        return NULL;
    }
    return SECITEM_DupItem(&inEncValue->valueHint);
}

Here is the call graph for this function:

Definition at line 541 of file crmfcont.c.

Here is the call graph for this function:

SECStatus CRMF_GetCertTemplateSubjectUID ( CRMFCertRequest *  inCertReq,
SECItem *  destSubjectUID 
)

Definition at line 578 of file crmfcont.c.

{
    return crmf_get_iv(mechType);
}

Here is the call graph for this function:

SECStatus CRMF_PKIArchiveOptionsGetArchiveRemGenPrivKey ( CRMFPKIArchiveOptions *  inOpt,
PRBool destVal 
)

Definition at line 179 of file servget.c.

{
    if (inOpt == NULL || destVal == NULL ||
       CRMF_PKIArchiveOptionsGetOptionType(inOpt) != crmfArchiveRemGenPrivKey){
        return SECFailure;
    }
    *destVal = (inOpt->option.archiveRemGenPrivKey.data[0] == hexFalse) 
                                                                 ? PR_FALSE:
                                                                   PR_TRUE;
    return SECSuccess;
}

Here is the call graph for this function:

CRMFEncryptedKey* CRMF_PKIArchiveOptionsGetEncryptedPrivKey ( CRMFPKIArchiveOptions *  inOpts)

Definition at line 193 of file servget.c.

{
    CRMFEncryptedKey *newEncrKey = NULL;
    SECStatus         rv;

    PORT_Assert(inOpts != NULL);
    if (inOpts == NULL ||
       CRMF_PKIArchiveOptionsGetOptionType(inOpts) != crmfEncryptedPrivateKey){
        return NULL;
    }
    newEncrKey = PORT_ZNew(CRMFEncryptedKey);
    if (newEncrKey == NULL) {
        goto loser;
    }
    rv = crmf_copy_encryptedkey(NULL, &inOpts->option.encryptedKey,
                            newEncrKey);
    if (rv != SECSuccess) {
        goto loser;
    }
    return newEncrKey;
 loser:
    if (newEncrKey != NULL) {
        CRMF_DestroyEncryptedKey(newEncrKey);
    }
    return NULL;
}

Here is the call graph for this function:

SECItem* CRMF_PKIArchiveOptionsGetKeyGenParameters ( CRMFPKIArchiveOptions *  inOptions)

Definition at line 221 of file servget.c.

{
    if (inOptions == NULL ||
       CRMF_PKIArchiveOptionsGetOptionType(inOptions) != crmfKeyGenParameters ||
       inOptions->option.keyGenParameters.data == NULL) {
        return NULL;
    }
    return SECITEM_DupItem(&inOptions->option.keyGenParameters);
}

Here is the call graph for this function:

CRMFPKIArchiveOptionsType CRMF_PKIArchiveOptionsGetOptionType ( CRMFPKIArchiveOptions *  inOptions)

Definition at line 232 of file servget.c.

{
    PORT_Assert (inOptions != NULL);
    if (inOptions == NULL) {
        return crmfNoArchiveOptions;
    }
    return inOptions->archOption;
}
CRMFPOPOPrivKeyChoice CRMF_POPOPrivKeyGetChoice ( CRMFPOPOPrivKey *  inKey)

Definition at line 281 of file servget.c.

{
    PORT_Assert(inPrivKey != NULL);
    if (inPrivKey != NULL) {
        return inPrivKey->messageChoice;
    }
    return crmfNoMessage;
}
SECStatus CRMF_POPOPrivKeyGetDHMAC ( CRMFPOPOPrivKey *  inKey,
SECItem *  destMAC 
)

Definition at line 291 of file servget.c.

{
    PORT_Assert(inKey != NULL);
    if (inKey == NULL || inKey->message.dhMAC.data == NULL) {
        return SECFailure;
    }
    return crmf_make_bitstring_copy(NULL, destMAC, &inKey->message.dhMAC);
}

Here is the call graph for this function:

SECStatus CRMF_POPOPrivKeyGetSubseqMess ( CRMFPOPOPrivKey *  inKey,
CRMFSubseqMessOptions destOpt 
)
SECStatus CRMF_POPOPrivKeyGetThisMessage ( CRMFPOPOPrivKey *  inKey,
SECItem *  destString 
)

Definition at line 301 of file servget.c.

{
    PORT_Assert(inKey != NULL);
    if (inKey == NULL           ||
       inKey->messageChoice != crmfThisMessage) {
        return SECFailure;
    }

    return crmf_make_bitstring_copy(NULL, destString, 
                                &inKey->message.thisMessage);
}

Here is the call graph for this function:

SECAlgorithmID* CRMF_POPOSigningKeyGetAlgID ( CRMFPOPOSigningKey *  inSignKey)

Definition at line 315 of file servget.c.

{
    SECAlgorithmID *newAlgId = NULL;
    SECStatus       rv;

    PORT_Assert(inSignKey != NULL);
    if (inSignKey == NULL) {
        return NULL;
    }
    newAlgId = PORT_ZNew(SECAlgorithmID);
    if (newAlgId == NULL) {
        goto loser;
    }
    rv = SECOID_CopyAlgorithmID(NULL, newAlgId, 
                            inSignKey->algorithmIdentifier);
    if (rv != SECSuccess) {
        goto loser;
    }
    return newAlgId;

 loser:
    if (newAlgId != NULL) {
        SECOID_DestroyAlgorithmID(newAlgId, PR_TRUE);
    }
    return NULL;
}

Here is the call graph for this function:

SECItem* CRMF_POPOSigningKeyGetInput ( CRMFPOPOSigningKey *  inSignKey)

Definition at line 343 of file servget.c.

{
    PORT_Assert(inSignKey != NULL);
    if (inSignKey == NULL || inSignKey->derInput.data == NULL) {
        return NULL;
    }
    return SECITEM_DupItem(&inSignKey->derInput);
}

Here is the call graph for this function:

SECItem* CRMF_POPOSigningKeyGetSignature ( CRMFPOPOSigningKey *  inSignKey)

Definition at line 353 of file servget.c.

{
    SECItem   *newSig = NULL;
    SECStatus  rv;

    PORT_Assert(inSignKey != NULL);
    if (inSignKey == NULL) {
        return NULL;
    }
    newSig = PORT_ZNew(SECItem);
    if (newSig == NULL) {
        goto loser;
    }
    rv = crmf_make_bitstring_copy(NULL, newSig, &inSignKey->signature);
    if (rv != SECSuccess) {
        goto loser;
    }
    return newSig;
 loser:
    if (newSig != NULL) {
        SECITEM_FreeItem(newSig, PR_TRUE);
    }
    return NULL;
}

Here is the call graph for this function: