RSA Security logo

RSA BSAFE Cert-C
API Reference

pkictmsg.h File Reference

This file defines the PKI certificate template object.

#include "basetype.h"
#include "bsafe.h"
#include "certext.h"
#include "certapi.h"
#include "certalg.h"
#include "pkistinf.h"
#include "pkimsg.h"

Go to the source code of this file.

Typedefs

typedef POINTER PKI_CERT_TEMPLATE_OBJ
 Represents the template that specifies the information that goes into a certificate in the certificate request process. More...


Functions

int C_CreatePKICertTemplateObject (CERTC_CTX ctx, PKI_CERT_TEMPLATE_OBJ *pPKICertTmplObj)
 Creates and initializes a PKI certificate template object. More...

void C_DestroyPKICertTemplateObject (PKI_CERT_TEMPLATE_OBJ *pPKICertTmplObj)
 Frees memory used by a certificate template object. More...

int C_GetPKICertTemplateFromCertObject (CERT_OBJ certobj, PKI_CERT_TEMPLATE_OBJ PKICertTmplObj)
 Uses information from a certificate object to populate a certificate template object. More...

int C_SetCertTemplateVersion (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT2 version)
 Sets the certificate's version number. More...

int C_GetCertTemplateVersion (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT2 *pVersion)
 Gets the certificate's version number. More...

int C_SetCertTemplateSerialNumber (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, ITEM *pSerialNumber)
 Sets the certificate's serial number. More...

int C_GetCertTemplateSerialNumber (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, ITEM *pSerialNumber)
 Gets the certificate's serial number. More...

int C_SetCertTemplateSignatureAlgorithm (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, int signatureAlgorithm)
 Sets the signature algorithm that indicates the algorithm used to create the certificate signature. More...

int C_GetCertTemplateSignatureAlgorithm (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, int *pSignatureAlgorithm)
 Gets the signature algorithm that indicates the algorithm used to create the certificate signature. More...

int C_SetCertTemplateIssuerName (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, NAME_OBJ issuerName)
 Sets the issuer name that contains the name of the issuer that signed the certificate. More...

int C_GetCertTemplateIssuerName (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, NAME_OBJ *pIssuerName)
 Gets the issuer name that contains the name of the issuer that signed the certificate. More...

int C_SetCertTemplateValidityStart (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT4 start)
 Sets the validity start time of the certificate. More...

int C_SetCertTemplateValidityEnd (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT4 end)
 Sets the validity end time of the certificate. More...

int C_GetCertTemplateValidityStart (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT4 *pStart)
 Gets the validity start time of the certificate. More...

int C_GetCertTemplateValidityEnd (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, UINT4 *pEnd)
 Gets the validity end time of the certificate. More...

int C_SetCertTemplateSubjectName (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, NAME_OBJ subjectName)
 Sets the certificate's subject name. More...

int C_GetCertTemplateSubjectName (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, NAME_OBJ *pSubjectName)
 Gets the certificate's subject name. More...

int C_SetCertTemplatePublicKey (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, ITEM *pPubKey)
 Sets the certificate's DER-encoded public key. More...

int C_GetCertTemplatePublicKey (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, ITEM *pPubKey)
 Gets the certificate's DER-encoded public key. More...

int C_SetCertTemplateIssuerUniqueID (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, BIT_STRING *pIssuerID)
 Sets, inserts, or replaces the issuer ID in PKI_CERT_TEMPLATE_OBJ. More...

int C_GetCertTemplateIssuerUniqueID (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, BIT_STRING *pIssuerID)
 Gets the issuer ID in PKI_CERT_TEMPLATE_OBJ. More...

int C_SetCertTemplateSubjectUniqueID (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, BIT_STRING *pSubjectID)
 Sets the subject unique ID that points to the certificate subject's unique identification. More...

int C_GetCertTemplateSubjectUniqueID (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, BIT_STRING *pSubjectID)
 Gets the subject unique ID that points to the certificate subject's unique identification. More...

int C_SetCertTemplateExtensions (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, EXTENSIONS_OBJ extensions)
 Sets the certificate extensions object that contains X.509 v3 extensions for the certificate. More...

int C_GetCertTemplateExtensions (PKI_CERT_TEMPLATE_OBJ PKICertTmplObj, EXTENSIONS_OBJ *pExtensions)
 Gets the certificate extensions object that contains X.509 v3 extensions for the certificate. More...


Typedef Documentation

typedef POINTER PKI_CERT_TEMPLATE_OBJ
 

Represents the template that specifies the information that goes into a certificate in the certificate request process. Use a Cert-C function to view or modify information in this object. Do not assume that this object points to any specific information. Some examples of the functions that Cert-C provides to work with a PKI certificate-template object are listed in the following table.

Function Description

C_CreatePKICertTemplateObject() Creates and initializes a PKI certificate-template object.
C_DestroyPKICertTemplateObject() Destroys the PKI certificate-template object and frees any memory associated with it.
C_SetCertTemplateExtensions() Sets the certificate extensions object that contains X.509 v3 extensions for the certificate.
C_SetCertTemplateIssuerName() Sets the issuer name that contains the name of the issuer that signed the certificate.
C_SetCertTemplateIssuerUniqueID() Sets the issuer unique ID that contains the certificate’s issuer’s unique identifier.
C_SetCertTemplatePublicKey() Sets the certificate's DER-encoded public key.
C_SetCertTemplateSerialNumber() Sets the certificate’s serial number.
C_SetCertTemplateSignatureAlgorithm() Sets the certificate’s signature algorithm.
C_SetCertTemplateSubjectName() Sets the certificate’s subject name.
C_SetCertTemplateSubjectUniqueID() Sets the subject unique ID that contains the certificate subject’s unique identification.
C_SetCertTemplateValidityEnd() Sets the validity end time of the certificate.
C_SetCertTemplateValidityStart() Sets the validity start time of the certificate.
C_SetCertTemplateVersion() Sets the certificate’s version number.
C_GetCertTemplateExtensions() Gets the certificate’s extensions object that contains X.509 v3 extensions for the certificate.
C_GetCertTemplateIssuerName() Gets the issuer name that contains the name of the issuer that signed the certificate.
C_GetCertTemplateIssuerUniqueID() Gets the issuer unique ID that contains the certificate’s issuer’s unique identifier.
C_GetCertTemplatePublicKey() Gets the certificate’s DER-encoded public key.
C_GetCertTemplateSerialNumber() Gets the certificate’s serial number.
C_GetCertTemplateSignatureAlgorithm() Gets the signature algorithm that indicates the algorithm used to create the certificate signature.
C_GetCertTemplateSubjectName() Gets the certificate’s subject name.
C_GetCertTemplateSubjectUniqueID() Gets the subject unique ID that contains the certificate subject’s unique identification.
C_GetCertTemplateValidityEnd() Gets the validity end time of the certificate.
C_GetCertTemplateValidityStart() Gets the validity start time of the certificate.
C_GetCertTemplateVersion() Gets the certificate’s version number.
C_GetPKICertTemplateFromCertObject() Gets information from a certificate object to populate a certificate-template object.


Function Documentation

int C_CreatePKICertTemplateObject CERTC_CTX    ctx,
PKI_CERT_TEMPLATE_OBJ   pPKICertTmplObj
;
 

Creates and initializes a PKI certificate template object.

Parameters:
ctx This input parameter is the Cert-C context.
pPKICertTmplObj This input/output parameter specifies the certificate template object.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

void C_DestroyPKICertTemplateObject PKI_CERT_TEMPLATE_OBJ   pPKICertTmplObj ;
 

Frees memory used by a certificate template object.

Parameters:
pPKICertTmplObj This input/output parameter specifies the certificate template object.
Returns:
None.

int C_GetCertTemplateExtensions PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
EXTENSIONS_OBJ   pExtensions
;
 

Gets the certificate extensions object that contains X.509 v3 extensions for the certificate.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pExtensions This output parameter specifies the certificate extensions.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateIssuerName PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
NAME_OBJ   pIssuerName
;
 

Gets the issuer name that contains the name of the issuer that signed the certificate.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pIssuerName This output parameter specifies the issuer name.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateIssuerUniqueID PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
BIT_STRING   pIssuerID
;
 

Gets the issuer ID in PKI_CERT_TEMPLATE_OBJ. The issuer ID identifies the issuer of a certificate. The PKI_CERT_TEMPLATE_OBJ is designed to mirror information in the certificate, such as issuer serial number or name, subname, or extensions.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pIssuerID This output parameter specifies the unique ID of the issuer.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplatePublicKey PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
ITEM *    pPubKey
;
 

Gets the certificate's DER-encoded public key.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pPubKey This output parameter specifies the public key.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateSerialNumber PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
ITEM *    pSerialNumber
;
 

Gets the certificate's serial number.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pSerialNumber This output parameter specifies the serial number.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateSignatureAlgorithm PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
int *    pSignatureAlgorithm
;
 

Gets the signature algorithm that indicates the algorithm used to create the certificate signature.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pSignatureAlgorithm This output parameter specifies the signature algorithm.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateSubjectName PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
NAME_OBJ   pSubjectName
;
 

Gets the certificate's subject name.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pSubjectName This output parameter specifies the name of the subject.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateSubjectUniqueID PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
BIT_STRING   pSubjectID
;
 

Gets the subject unique ID that points to the certificate subject's unique identification.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pSubjectID This output parameter specifies the ID of the subject.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateValidityEnd PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT4 *    pEnd
;
 

Gets the validity end time of the certificate.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pEnd This output parameter specifies the end of the validity period.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateValidityStart PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT4 *    pStart
;
 

Gets the validity start time of the certificate.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pStart This output parameter specifies the beginning of the validity period.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetCertTemplateVersion PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT2 *    pVersion
;
 

Gets the certificate's version number.

Parameters:
PKICertTmplObj This input parameter specifies the certificate template object.
pVersion This output parameter specifies the version of the certificate template.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_GetPKICertTemplateFromCertObject CERT_OBJ    certobj,
PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj
;
 

Uses information from a certificate object to populate a certificate template object.

Parameters:
certobj This input parameter is the certificate object.
PKICertTmplObj This input/output parameter specifies the certificate template object.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateExtensions PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
EXTENSIONS_OBJ    extensions
;
 

Sets the certificate extensions object that contains X.509 v3 extensions for the certificate.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
extensions This input parameter specifies the certificate extensions.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateIssuerName PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
NAME_OBJ    issuerName
;
 

Sets the issuer name that contains the name of the issuer that signed the certificate.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
issuerName This input parameter specifies the issuer name.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateIssuerUniqueID PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
BIT_STRING   pIssuerID
;
 

Sets, inserts, or replaces the issuer ID in PKI_CERT_TEMPLATE_OBJ. The issuer ID identifies the issuer of a certificate. The PKI_CERT_TEMPLATE_OBJ is designed to mirror information in the certificate, such as issuer serial number or name, subname, or extensions.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
pIssuerID This input parameter specifies the unique ID of the issuer.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplatePublicKey PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
ITEM *    pPubKey
;
 

Sets the certificate's DER-encoded public key.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
pPubKey This input parameter specifies the public key.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateSerialNumber PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
ITEM *    pSerialNumber
;
 

Sets the certificate's serial number.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
pSerialNumber This input parameter specifies the serial number.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateSignatureAlgorithm PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
int    signatureAlgorithm
;
 

Sets the signature algorithm that indicates the algorithm used to create the certificate signature.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
signatureAlgorithm This input parameter specifies the signature algorithm. Possible values are, as follows:
      SA_UNDEFINED 
      SA_MD2_WITH_RSA_ENCRYPTION 
      SA_MD5_WITH_RSA_ENCRYPTION
      SA_SHA1_WITH_RSA_ENCRYPTION 
      SA_OIW_SHA1_WITH_RSA_ENCRYPTION 
      SA_DSA_WITH_SHA1
      SA_RSA_ENCRYPTION
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateSubjectName PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
NAME_OBJ    subjectName
;
 

Sets the certificate's subject name.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
subjectName This input parameter specifies the name of the subject.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateSubjectUniqueID PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
BIT_STRING   pSubjectID
;
 

Sets the subject unique ID that points to the certificate subject's unique identification.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
pSubjectID This input parameter specifies the ID of the subject.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateValidityEnd PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT4    end
;
 

Sets the validity end time of the certificate.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
end This input parameter specifies the end of the validity period.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateValidityStart PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT4    start
;
 

Sets the validity start time of the certificate.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
start This input parameter specifies the beginning of the validity period.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int C_SetCertTemplateVersion PKI_CERT_TEMPLATE_OBJ    PKICertTmplObj,
UINT2    version
;
 

Sets the certificate's version number.

Parameters:
PKICertTmplObj This input/output parameter specifies the certificate template object.
version This input parameter specifies the version of the certificate template.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.



RSA BSAFE® Cert-C 2.7 API Reference