RSA BSAFE Cert-C

Certificate Components for C

Crypto-C 6.2.1 Developer's Guide
Search

certapi.h

Go to the documentation of this file.
00001 /* $Id: certapi.h,v 1.11 2005/03/08 00:10:09 alockwoo Exp $ */
00002 /*
00003 * Copyright (c) RSA Security Inc., 1999-2003.  All rights reserved.
00004 * This work contains proprietary, confidential, and trade secret
00005 * information of RSA Security Inc.  Use, disclosure or reproduction
00006 * without the express written authorization of RSA Security Inc. is
00007 * prohibited.
00008 */
00009 
00010 #ifndef HEADER_BSAFE_CERTC_CERTAPI
00011 #define HEADER_BSAFE_CERTC_CERTAPI 1
00012 
00018 #include "basetype.h"
00019 #include "certext.h"
00020 #include "certalg.h"     /* for SA_*, DAI_*, KA_* */
00021 
00022 #ifdef __cplusplus
00023 extern "C" {
00024 #endif
00025 
00026 #define CERT_VERSION_1   0    /* 1988 certificate format */
00027 #define CERT_VERSION_2   1    /* 1993 certificate format */
00028 #define CERT_VERSION_3   2    /* 1995 certificate format */
00029 #define DEFAULT_CERT_VERSION CERT_VERSION_1
00030 
00035 typedef struct CERT_FIELDS {
00036 
00057   UINT2 version;
00058 
00069   ITEM serialNumber;
00070 
00099   int signatureAlgorithm;
00100 
00107   NAME_OBJ issuerName;
00108 
00119   struct {
00120     UINT4 start;
00121     UINT4 end;
00122   } validity;
00123 
00128   NAME_OBJ subjectName;
00129 
00136   ITEM publicKey;
00137 
00148   BIT_STRING issuerUniqueID;
00149 
00161   BIT_STRING subjectUniqueID;
00162 
00170   EXTENSIONS_OBJ certExtensions;
00171 
00175   POINTER reserved;
00176 } CERT_FIELDS;
00177 
00178 int C_CreateCertObject (
00179   CERT_OBJ   *certObj,           /* (out) certificate object */
00180   CERTC_CTX   ctx);              /* (in)  Cert-C context     */
00181 
00182 int C_CreateCertObjectReference(
00183     CERTC_CTX   ctx,                /* (in) Cert-C context */
00184     CERT_OBJ    certObj,            /* (in) Certificate object */
00185     CERT_OBJ*   certObjRef );       /* (out) a reference to the certificate object */
00186 
00187 int C_SetCertFields (
00188   CERT_OBJ          certObj,            /* certificate object */
00189   CERT_FIELDS       *certFields);       /* certificate fields */
00190 
00191 int C_GetCertDER (
00192   CERT_OBJ          certObj,            /* certificate object */
00193   unsigned char     **der,              /* (out) encoded certificate */
00194   unsigned int      *derLen);           /* (out) length of encoding */
00195 
00196 int C_SetCertBER (
00197   CERT_OBJ          certObj,            /* certificate object */
00198   unsigned char     *ber,               /* encoded certificate */
00199   unsigned int      berLen);            /* length of encoding */
00200 
00201 int C_SetCertInnerBER (
00202   CERT_OBJ          certObj,            /* certificate object */
00203   unsigned char     *ber,               /* encoded certificate */
00204   unsigned int      berLen);            /* length of encoding */
00205 
00206 int C_GetCertFields (
00207   CERT_OBJ          certObj,            /* certificate object */
00208   CERT_FIELDS       *certFields);       /* certificate fields */
00209 
00210 int C_GetCertInnerDER (
00211   CERT_OBJ          certObj,            /* certificate object */
00212   unsigned char     **der,              /* (out) encoded certificate */
00213   unsigned int      *derLen);           /* (out) length of encoding */
00214 
00215 int C_ResetCertObject (
00216   CERT_OBJ certObj);       /* (mod) certificate object */
00217 
00218 void C_DestroyCertObject (
00219   CERT_OBJ          *certObj);       /* (mod) certificate object */
00220 
00221 int C_SignCert (
00222   CERT_OBJ          certObj,    /* certificate object */
00223   B_KEY_OBJ         privateKey, /* signing key */
00224   ...);                         /* extra parameter for old BCERT C_SignCert */
00225 
00226 int C_VerifyCertSignature (
00227   CERT_OBJ          certObj,   /* certificate object */
00228   B_KEY_OBJ         publicKey, /* verification key */
00229   ...);                        /* extra parameters for old BCERT C_VerifyCert */
00230 
00231 #ifdef __cplusplus
00232 }
00233 #endif
00234 
00235 #endif /* HEADER_BSA