![]() |
RSA BSAFE Cert-C |
00001 /* 00002 * Copyright (c) RSA Security Inc., 1999-2003. All rights reserved. 00003 * This work contains proprietary, confidential, and trade secret 00004 * information of RSA Security Inc. Use, disclosure or reproduction 00005 * without the express written authorization of RSA Security Inc. is 00006 * prohibited. 00007 */ 00008 00009 #ifndef HEADER_BSAFE_CERTC_CERTAPI 00010 #define HEADER_BSAFE_CERTC_CERTAPI 1 00011 00017 #include "basetype.h" 00018 #include "certext.h" 00019 #include "certalg.h" /* for SA_*, DAI_*, KA_* */ 00020 00021 #ifdef __cplusplus 00022 extern "C" { 00023 #endif 00024 00025 #define CERT_VERSION_1 0 /* 1988 certificate format */ 00026 #define CERT_VERSION_2 1 /* 1993 certificate format */ 00027 #define CERT_VERSION_3 2 /* 1995 certificate format */ 00028 #define DEFAULT_CERT_VERSION CERT_VERSION_1 00029 00176 typedef struct CERT_FIELDS { 00177 UINT2 version; 00178 ITEM serialNumber; 00179 int signatureAlgorithm; 00180 NAME_OBJ issuerName; 00181 struct { 00182 UINT4 start; 00183 UINT4 end; 00184 } validity; 00185 NAME_OBJ subjectName; 00186 ITEM publicKey; 00187 BIT_STRING issuerUniqueID; /* version 2 and 3 only. Set data field */ 00188 /* to NULL_PTR, len to 0 if omit */ 00189 BIT_STRING subjectUniqueID; /* version 2 and 3 only. Set data field */ 00190 /* to NULL_PTR, len to 0 if omit */ 00191 EXTENSIONS_OBJ certExtensions; /* version 3 only. Set to */ 00192 /* (EXTENSIONS_OBJ)NULL_PTR if omitted */ 00193 POINTER reserved; /* reserves for future expansion */ 00194 } CERT_FIELDS; 00195 00212 int C_CreateCertObject ( 00213 CERT_OBJ *certObj, /* (out) certificate object */ 00214 CERTC_CTX ctx); /* (in) Cert-C context */ 00215 00238 int C_CreateCertObjectReference( 00239 CERTC_CTX ctx, /* (in) Cert-C context */ 00240 CERT_OBJ certObj, /* (in) Certificate object */ 00241 CERT_OBJ* certObjRef ); /* (out) a reference to the certificate object */ 00242 00268 int C_SetCertFields ( 00269 CERT_OBJ certObj, /* certificate object */ 00270 CERT_FIELDS *certFields); /* certificate fields */ 00271 00295 int C_GetCertDER ( 00296 CERT_OBJ certObj, /* certificate object */ 00297 unsigned char **der, /* (out) encoded certificate */ 00298 unsigned int *derLen); /* (out) length of encoding */ 00299 00331 int C_SetCertBER ( 00332 CERT_OBJ certObj, /* certificate object */ 00333 unsigned char *ber, /* encoded certificate */ 00334 unsigned int berLen); /* length of encoding */ 00335 00362 int C_SetCertInnerBER ( 00363 CERT_OBJ certObj, /* certificate object */ 00364 unsigned char *ber, /* encoded certificate */ 00365 unsigned int berLen); /* length of encoding */ 00366 00394 int C_GetCertFields ( 00395 CERT_OBJ certObj, /* certificate object */ 00396 CERT_FIELDS *certFields); /* certificate fields */ 00397 00428 int C_GetCertInnerDER ( 00429 CERT_OBJ certObj, /* certificate object */ 00430 unsigned char **der, /* (out) encoded certificate */ 00431 unsigned int *derLen); /* (out) length of encoding */ 00432 00452 int C_ResetCertObject ( 00453 CERT_OBJ certObj); /* (mod) certificate object */ 00454 00470 void C_DestroyCertObject ( 00471 CERT_OBJ *certObj); /* (mod) certificate object */ 00472 00493 int C_SignCert ( 00494 CERT_OBJ certObj, /* certificate object */ 00495 B_KEY_OBJ privateKey, /* signing key */ 00496 ...); /* extra parameter for old BCERT C_SignCert */ 00497 00528 int C_VerifyCertSignature ( 00529 CERT_OBJ certObj, /* certificate object */ 00530 B_KEY_OBJ publicKey, /* verification key */ 00531 ...); /* extra parameters for old BCERT C_VerifyCert */ 00532 00533 #ifdef __cplusplus 00534 } 00535 #endif 00536 00537 #endif /* HEADER_BSAFE_CERTC_CERTAPI */