cmmf.h

来自「支持SSL v2/v3, TLS, PKCS #5, PKCS #7, PKCS」· C头文件 代码 · 共 1,120 行 · 第 1/3 页

H
1,120
字号
 *    SECSuccess if adding the caCerts was successful.  Any other return value *    indicates an error while tring to add the caCerts. */extern SECStatus        CMMF_KeyRecRepContentSetCACerts(CMMFKeyRecRepContent *inKeyRecRep,				       CERTCertList         *inCACerts);/* * FUNCTION: CMMF_KeyRecRepContentSetCertifiedKeyPair * INPUTS: *    inKeyRecRep *        The CMMFKeyRecRepContent to operate on. *    inCert *        The certificate to add to the CMMFKeyRecRepContent structure. *    inPrivKey *        The private key associated with the certificate above passed in. *    inPubKey *        The public key to use for wrapping the private key. * NOTES: *    This function adds another certificate-key pair to the  *    CMMFKeyRecRepcontent structure.  There may be more than one  *    certificate-key pair in the structure, so the user must call this  *    function multiple times to add more than one cert-key pair. * * RETURN: *    SECSuccess if adding the certified key pair was successful.  Any other *    return value indicates an error in adding certified key pair to  *    CMMFKeyRecRepContent structure. */extern SECStatus     CMMF_KeyRecRepContentSetCertifiedKeyPair(CMMFKeyRecRepContent *inKeyRecRep,					     CERTCertificate      *inCert,					     SECKEYPrivateKey     *inPrivKey,					     SECKEYPublicKey      *inPubKey);/* * FUNCTION: CMMF_POPODecKeyChallContentSetNextChallenge * INPUTS: *    inDecKeyChall *        The CMMFPOPODecKeyChallContent to operate on. *    inRandom *        The random number to use when generating the challenge, *    inSender *        The GeneralName representation of the sender of the challenge. *    inPubKey *        The public key to use when encrypting the challenge. *    passwdArg *        This value will be passed to the function used for getting a *        password.  The password for getting a password should be registered *        by calling PK11_SetPasswordFunc before this function is called.  *        If no password callback is registered and the library needs to  *        authenticate to the slot for any reason, this function will fail. * NOTES: *    This function adds a challenge to the end of the list of challenges *    contained by 'inDecKeyChall'.  Refer to the CMMF draft on how the *    the random number passed in and the sender's GeneralName are used *    to generate the challenge and witness fields of the challenge.  This *    library will use SHA1 as the one-way function for generating the  *    witess field of the challenge. * * RETURN: *    SECSuccess if generating the challenge and adding to the end of list *    of challenges was successful.  Any other return value indicates an error *    while trying to generate the challenge. */extern SECStatusCMMF_POPODecKeyChallContentSetNextChallenge                                   (CMMFPOPODecKeyChallContent *inDecKeyChall,				    long                        inRandom,				    CERTGeneralName            *inSender,				    SECKEYPublicKey            *inPubKey,				    void                       *passwdArg);/************************** Encoding Functions *************************//* * FUNCTION: CMMF_EncodeCertRepContent * INPUTS: *    inCertRepContent *        The CMMFCertRepContent to DER-encode. *    inCallback *        A callback function that the ASN1 encoder will call whenever it  *        wants to write out DER-encoded bytes.  Look at the defintion of  *        CRMFEncoderOutputCallback in crmft.h for a description of the *        parameters to the function. *    inArg *        An opaque pointer to a user-supplied argument that will be passed *        to the callback funtion whenever the function is called. * NOTES: *    The CMMF library will use the same DER-encoding scheme as the CRMF  *    library.  In other words, when reading CRMF comments that pertain to *    encoding, those comments apply to the CMMF libray as well.   *    The callback function will be called multiple times, each time supplying *    the next chunk of DER-encoded bytes.  The user must concatenate the  *    output of each successive call to the callback in order to get the *    entire DER-encoded CMMFCertRepContent structure. * * RETURN: *    SECSuccess if encoding the CMMFCertRepContent was successful.  Any  *    other return value indicates an error while decoding the structure. */extern SECStatus        CMMF_EncodeCertRepContent (CMMFCertRepContent        *inCertRepContent,				  CRMFEncoderOutputCallback  inCallback,				  void                      *inArg);/* * FUNCTION: CMMF_EncodeKeyRecRepContent * INPUTS: *    inKeyRecRep *        The CMMFKeyRepContent to DER-encode. *    inCallback *        A callback function that the ASN1 encoder will call whenever it  *        wants to write out DER-encoded bytes.  Look at the defintion of  *        CRMFEncoderOutputCallback in crmft.h for a description of the *        parameters to the function. *    inArg *        An opaque pointer to a user-supplied argument that will be passed *        to the callback funtion whenever the function is called. * NOTES: *    The CMMF library will use the same DER-encoding scheme as the CRMF  *    library.  In other words, when reading CRMF comments that pertain to *    encoding, those comments apply to the CMMF libray as well.   *    The callback function will be called multiple times, each time supplying *    the next chunk of DER-encoded bytes.  The user must concatenate the  *    output of each successive call to the callback in order to get the *    entire DER-encoded CMMFCertRepContent structure. * * RETURN: *    SECSuccess if encoding the CMMFKeyRecRepContent was successful.  Any  *    other return value indicates an error while decoding the structure. */extern SECStatus       CMMF_EncodeKeyRecRepContent(CMMFKeyRecRepContent      *inKeyRecRep,				   CRMFEncoderOutputCallback  inCallback,				   void                      *inArg);/* * FUNCTION: CMMF_EncodePOPODecKeyChallContent * INPUTS: *    inDecKeyChall *        The CMMFDecKeyChallContent to operate on. *    inCallback *        A callback function that the ASN1 encoder will call whenever it  *        wants to write out DER-encoded bytes.  Look at the defintion of  *        CRMFEncoderOutputCallback in crmft.h for a description of the *        parameters to the function. *    inArg *        An opaque pointer to a user-supplied argument that will be passed *        to the callback function whenever the function is called. * NOTES: *    The CMMF library will use the same DER-encoding scheme as the CRMF  *    library.  In other words, when reading CRMF comments that pertain to *    encoding, those comments apply to the CMMF libray as well.   *    The callback function will be called multiple times, each time supplying *    the next chunk of DER-encoded bytes.  The user must concatenate the  *    output of each successive call to the callback in order to get the *    entire DER-encoded CMMFCertRepContent structure. *    The DER will be an encoding of the type POPODecKeyChallContents, which *    is just a sequence of challenges. * * RETURN: *    SECSuccess if encoding was successful.  Any other return value indicates *    an error in trying to encode the Challenges. */extern SECStatus CMMF_EncodePOPODecKeyChallContent(CMMFPOPODecKeyChallContent *inDecKeyChall,				  CRMFEncoderOutputCallback inCallback,				  void                     *inArg);/* * FUNCTION: CMMF_EncodePOPODecKeyRespContent * INPUTS: *    inDecodedRand *        An array of integers to encode as the responses to  *        CMMFPOPODecKeyChallContent.  The integers must be in the same order *        as the challenges extracted from CMMFPOPODecKeyChallContent. *    inNumRand *        The number of random integers contained in the array 'inDecodedRand' *    inCallback *        A callback function that the ASN1 encoder will call whenever it  *        wants to write out DER-encoded bytes.  Look at the defintion of  *        CRMFEncoderOutputCallback in crmft.h for a description of the *        parameters to the function. *    inArg *        An opaque pointer to a user-supplied argument that will be passed *        to the callback funtion whenever the function is called. * NOTES: *    The CMMF library will use the same DER-encoding scheme as the CRMF  *    library.  In other words, when reading CRMF comments that pertain to *    encoding, those comments apply to the CMMF libray as well.   *    The callback function will be called multiple times, each time supplying *    the next chunk of DER-encoded bytes.  The user must concatenate the  *    output of each successive call to the callback in order to get the *    entire DER-encoded  POPODecKeyRespContent. * * RETURN: *    SECSuccess if encoding was successful.  Any other return value indicates *    an error in trying to encode the Challenges. */extern SECStatus       CMMF_EncodePOPODecKeyRespContent(long                     *inDecodedRand,				       int                       inNumRand,				       CRMFEncoderOutputCallback inCallback,				       void                     *inArg); /***************  Accessor function  ***********************************//* * FUNCTION: CMMF_CertRepContentGetCAPubs * INPUTS: *    inCertRepContent *        The CMMFCertRepContent to extract the caPubs from. * NOTES: *    This function will return a copy of the list of certificates that *    make up the chain of CA's required to make the cert issued valid. *    The user must call CERT_DestroyCertList on the return value when  *    done using the return value.   * *    Only call this function on a CertRepContent that has been decoded. *    The client must call CERT_DestroyCertList when the certificate list *    is no longer needed.  * *    The certs in the list will not be in the temporary database.  In order *    to make these certificates a part of the permanent CA internal database, *    the user must collect the der for all of these certs and call  *    CERT_ImportCAChain.  Afterwards the certs will be part of the permanent *    database. *     * RETURN: *    A pointer to the CERTCertList representing the CA chain associated  *    with the issued cert.  A NULL return value indicates  that no CA Pubs *    were available in the CMMFCertRepContent structure.  */extern CERTCertList*        CMMF_CertRepContentGetCAPubs (CMMFCertRepContent *inCertRepContent);/* * FUNCTION: CMMF_CertRepContentGetNumResponses * INPUTS: *    inCertRepContent *        The CMMFCertRepContent to operate on. * NOTES: *    This function will return the number of CertResponses that are contained *    by the CMMFCertRepContent passed in. *  * RETURN: *    The number of CMMFCertResponses contained in the structure passed in. */extern int  CMMF_CertRepContentGetNumResponses (CMMFCertRepContent *inCertRepContent);/* * FUNCTION: CMMF_CertRepContentGetResponseAtIndex * INPUTS: *    inCertRepContent *        The CMMFCertRepContent to operate on. *    inIndex *        The index of the CMMFCertResponse the user wants a copy of. * NOTES: *    This funciton creates a copy of the CMMFCertResponse at the index  *    corresponding to the parameter 'inIndex'.  Indexing is done like a *    traditional C array, ie the valid indexes are (0...numResponses-1). *    The user must call CMMF_DestroyCertResponse after the return value is  *    no longer needed. * * RETURN: *    A pointer to the CMMFCertResponse at the index corresponding to  *    'inIndex'.  A return value of NULL indicates an error in copying  *    the CMMFCertResponse. */extern CMMFCertResponse*CMMF_CertRepContentGetResponseAtIndex (CMMFCertRepContent *inCertRepContent,				       int                 inIndex);/* * FUNCTION: CMMF_CertResponseGetCertReqId * INPUTS: *    inCertResp *        The CMMFCertResponse to operate on. * NOTES: *    This function returns the CertResponse.certReqId from the  *    CMMFCertResponse structure passed in.  If the return value is -1, that *    means there is no associated certificate request with the CertResponse. * RETURN: *    A long representing the id of the certificate request this  *    CMMFCertResponse corresponds to.  A return value of -1 indicates an *    error in extracting the value of the integer. */extern long CMMF_CertResponseGetCertReqId(CMMFCertResponse *inCertResp);/* * FUNCTION: CMMF_CertResponseGetPKIStatusInfoStatus * INPUTS: *    inCertResp *        The CMMFCertResponse to operate on. * NOTES: *    This function returns the CertResponse.status.status field of the  *    CMMFCertResponse structure. * * RETURN: *    The enumerated value corresponding to the PKIStatus defined in the CMMF *    draft.  See the CMMF draft for the definition of PKIStatus.  See crmft.h *    for the definition of CMMFPKIStatus. */extern CMMFPKIStatus        CMMF_CertResponseGetPKIStatusInfoStatus(CMMFCertResponse *inCertResp);/* * FUNCTION: CMMF_CertResponseGetCertificate * INPUTS: *    inCertResp *        The Certificate Response to operate on. *    inCertdb *        This is the certificate database where the function will place the *        newly issued certificate. * NOTES: *    This function retrieves the CertResponse.certifiedKeyPair.certificate *    from the CMMFCertResponse.  The user will get a copy of that certificate *    so  the user must call CERT_DestroyCertificate when the return value is  *    no longer needed.  The certificate returned will be in the temporary  *    certificate database. * * RETURN: *    A pointer to a copy of the certificate contained within the  *    CMMFCertResponse.  A return value of NULL indicates an error while trying *    to make a copy of the certificate. */extern CERTCertificate*       CMMF_CertResponseGetCertificate(CMMFCertResponse *inCertResp,                                       CERTCertDBHandle *inCertdb);/* * FUNCTION: CMMF_KeyRecRepContentGetPKIStatusInfoStatus * INPUTS: *    inKeyRecRep *        The CMMFKeyRecRepContent structure to operate on. * NOTES: *    This function retrieves the KeyRecRepContent.status.status field of  *    the CMMFKeyRecRepContent structure. * RETURN: *    The CMMFPKIStatus corresponding to the value held in the  *    CMMFKeyRecRepContent structure. */extern CMMFPKIStatus CMMF_KeyRecRepContentGetPKIStatusInfoStatus(CMMFKeyRecRepContent *inKeyRecRep);/* * FUNCTION: CMMF_KeyRecRepContentGetNewSignCert * INPUTS: *    inKeyRecRep *        The CMMFKeyRecRepContent to operate on. * NOTES: *    This function retrieves the KeyRecRepContent.newSignCert field of the *    CMMFKeyRecRepContent structure.  The user must call  *    CERT_DestroyCertificate when the return value is no longer needed. The *    returned certificate will be in the temporary database.  The user  *    must then place the certificate permanently in whatever token the *    user determines is the proper destination.  A return value of NULL *    indicates the newSigCert field was not present. */extern CERTCertificate*       CMMF_KeyRecRepContentGetNewSignCert(CMMFKeyRecRepContent *inKeyRecRep);/* * FUNCTION: CMMF_KeyRecRepContentGetCACerts * INPUTS: *    inKeyRecRep *        The CMMFKeyRecRepContent to operate on. * NOTES: *    This function returns a CERTCertList which contains all of the  *    certficates that are in the sequence KeyRecRepContent.caCerts

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?