RSA Security logo

RSA BSAFE Cert-C
API Reference

rsacsp.h

Go to the documentation of this file.
00001 /*
00002 ** Copyright (c) 1999-2003, RSA Security Inc.
00003 **
00004 ** This file is used to demonstrate how to interface to an RSA
00005 ** Security licensed development product.  You have a
00006 ** royalty-free right to use, modify, reproduce and distribute this
00007 ** demonstration file (including any modified version), provided that
00008 ** you agree that RSA Security has no warranty, implied or
00009 ** otherwise, or liability for this demonstration file or any modified
00010 ** version.
00011 **
00012 */
00013 
00023 #ifndef HEADER_BSAFE_CERTC_RSACSP
00024 #define HEADER_BSAFE_CERTC_RSACSP 1
00025 
00026 #include "service.h"
00027 #include "bsafe.h"
00028 
00029 #ifdef __cplusplus
00030 extern "C" {
00031 #endif
00032 
00033 #if (CERTC_SW_PLATFORM == CERTC_SW_WINDOWS)
00034 # ifdef _MSC_VER
00035 #  pragma warning ( disable: 344 )
00036     typedef const char * LPCTSTR ;
00037     typedef char * LPTSTR ;
00038 #  pragma warning ( default: 344 )
00039 # endif
00040 #else
00041 # if defined(UNICODE) || defined(_UNICODE)
00042 #   define LPCTSTR const unsigned short *
00043 #   define LPTSTR  unsigned short *
00044 # else
00045 #   define LPCTSTR const char *
00046 #   define LPTSTR  char *
00047 # endif
00048 #endif
00049 
00050 /* These are in a provider-specific header file
00051    to avoid the need to include the windows
00052    header files and thus turn off compiler checks.
00053  */
00054 #ifndef PROV_RSA_FULL
00055 
00056 #define AT_KEYEXCHANGE          1
00057 #define AT_SIGNATURE            2
00058 
00059 #define PROV_RSA_FULL           1
00060 #define PROV_RSA_SIG            2
00061 
00062 #define MS_DEF_PROV_A       "Microsoft Base Cryptographic Provider v1.0"
00063 #define MS_DEF_PROV_W       L"Microsoft Base Cryptographic Provider v1.0"
00064 #ifdef UNICODE
00065 #define MS_DEF_PROV         MS_DEF_PROV_W
00066 #else
00067 #define MS_DEF_PROV         MS_DEF_PROV_A
00068 #endif
00069 
00070 #define MS_ENHANCED_PROV_A       "Microsoft Enhanced Cryptographic Provider v1.0"
00071 #define MS_ENHANCED_PROV_W       L"Microsoft Enhanced Cryptographic Provider v1.0"
00072 #ifdef UNICODE
00073 #define MS_ENHANCED_PROV         MS_ENHANCED_PROV_W
00074 #else
00075 #define MS_ENHANCED_PROV         MS_ENHANCED_PROV_A
00076 #endif
00077 
00078 #define MS_DEF_RSA_SIG_PROV_A    "Microsoft RSA Signature Cryptographic Provider"
00079 #define MS_DEF_RSA_SIG_PROV_W    L"Microsoft RSA Signature Cryptographic Provider"
00080 #ifdef UNICODE
00081 #define MS_DEF_RSA_SIG_PROV      MS_DEF_RSA_SIG_PROV_W
00082 #else
00083 #define MS_DEF_RSA_SIG_PROV      MS_DEF_RSA_SIG_PROV_A
00084 #endif
00085 
00086 #endif  /* PROV_RSA_FULL */
00087 
00088 /* CSP name for Keon desktop v 5.1 */
00089 #ifndef CERT_C_KEON_PROV
00090 #define CERT_C_KEON_PROV_A   "Security Dynamics Desktop Provider"
00091 #define CERT_C_KEON_PROV_W  L"Security Dynamics Desktop Provider"
00092 #if defined(UNICODE) || defined(_UNICODE)
00093 #define CERT_C_KEON_PROV     CERT_C_KEON_PROV_W
00094 #else
00095 #define CERT_C_KEON_PROV     CERT_C_KEON_PROV_A
00096 #endif
00097 #endif
00098 
00099 /* CSP name for Keon Desktop v 5.5 */
00100 #ifndef CERT_C_KEON_PROV_2
00101 #define CERT_C_KEON_PROV_2_A   "RSA Security Desktop Provider"
00102 #define CERT_C_KEON_PROV_2_W  L"RSA Security Desktop Provider"
00103 #if defined(UNICODE) || defined(_UNICODE)
00104 #define CERT_C_KEON_PROV_2     CERT_C_KEON_PROV_2_W
00105 #else
00106 #define CERT_C_KEON_PROV_2     CERT_C_KEON_PROV_2_A
00107 #endif
00108 #endif
00109 
00110 /* Type safe null values. */
00111 #define NULL_CONTAINER ((LPCTSTR)0)
00112 #define NULL_PROVIDER  ((LPCTSTR)0)
00113 
00114 
00115 /* Initialization routine for this provider.
00116  */
00117 
00173 int S_InitializeDefaultCSP (
00174   CERTC_CTX         ctx,                /* Cert-C context */
00175   POINTER           params,             /* provider-specific parameters */
00176   SERVICE_FUNCS     *funcs,             /* (out) provider functions */
00177   POINTER           *handle);           /* (out) provider handle */
00178 
00179 
00180 
00181 /* Initialization routine for this provider.when application
00182  * wishes to create a PKCS #11 enhanced chooser
00183  */
00184 
00254 int S_InitializeDefaultCSP2 (
00255   CERTC_CTX         ctx,                /* Cert-C context */
00256   POINTER           params,             /* provider-specific parameters */
00257   SERVICE_FUNCS     *funcs,             /* (out) provider functions */
00258   POINTER           *handle);           /* (out) provider handle */
00259 
00260 #ifdef WIN32
00261 
00289 int S_CERT_C_CAPI_GetPublicKeyObj (
00290   LPCTSTR      pszContainer,      /* in */
00291   LPCTSTR      pszProvider,       /* in */
00292   unsigned int dwProvType,        /* in, e.g. PROV_RSA_FULL */
00293   unsigned int dwKeySpec,         /* in, AT_KEYEXCHANGE or AT_SIGNATURE */
00294   B_KEY_OBJ   *publicKey);        /* out */
00295 
00296 
00297 /* Function to create a Cert-C CryptoAPI KI_Token for private key.
00298    The calls B_CreateKeyObject and B_SetKeyInfo on *privateKeyToken.
00299  */
00327 int S_CERT_C_CAPI_GetPrivateKeyObj (
00328   LPCTSTR      pszContainer,      /* in */
00329   LPCTSTR      pszProvider,       /* in */
00330   unsigned int dwProvType,        /* in, e.g. PROV_RSA_FULL */
00331   unsigned int dwKeySpec,         /* in, AT_KEYEXCHANGE or AT_SIGNATURE */
00332   B_KEY_OBJ   *privateKey);       /* out */
00333 
00334 
00365 int S_CERT_C_CAPI_ParsePrivateKeyObj (
00366   B_KEY_OBJ     privateKey,       /* in */
00367   LPTSTR       *pszContainer,     /* out */
00368   LPTSTR       *pszProvider,      /* out */
00369   unsigned int *dwProvType,       /* out */
00370   unsigned int *dwKeySpec);       /* out, AT_KEYEXCHANGE or AT_SIGNATURE */
00371 
00372 
00405 int S_CERT_C_CAPI_GetKeypair (
00406   LPCTSTR pszContainer,         /* in */
00407   LPCTSTR pszProvider,          /* in */
00408   unsigned int dwProvType,      /* in, e.g. PROV_RSA_FULL */
00409   unsigned int dwKeySpec,       /* in, AT_KEYEXCHANGE or AT_SIGNATURE */
00410   B_KEY_OBJ   *publicKey,       /* out */
00411   B_KEY_OBJ   *privateKey);     /* out */
00412 
00413 #endif /* WIN32 */
00414 
00415 #ifdef __cplusplus
00416 }
00417 #endif
00418 
00419 #endif /* HEADER_BSAFE_CERTC_RSACSP */



RSA BSAFE® Cert-C 2.7 API Reference