RSA Security logo

RSA BSAFE Cert-C
API Reference

rsacsp.h File Reference

This file defines the public interface to the default cryptographic service provider.

For more information on using this interface, see the Cert-C Default Cryptographic service provider.

#include "service.h"
#include "bsafe.h"

Go to the source code of this file.

Functions

int S_InitializeDefaultCSP (CERTC_CTX ctx, POINTER params, SERVICE_FUNCS *funcs, POINTER *handle)
 The S_InitializeDefaultCSP() function is never called directly. More...

int S_InitializeDefaultCSP2 (CERTC_CTX ctx, POINTER params, SERVICE_FUNCS *funcs, POINTER *handle)
 Initializes the Cert-C Default Cryptographic service provider when the application needs to create a PKCS #11-enhanced session chooser. More...

int S_CERT_C_CAPI_GetPublicKeyObj (LPCTSTR pszContainer, LPCTSTR pszProvider, unsigned int dwProvType, unsigned int dwKeySpec, B_KEY_OBJ *publicKey)
 Creates a Crypto-C B_KEY_OBJ from a CryptoAPI container name and key type. More...

int S_CERT_C_CAPI_GetPrivateKeyObj (LPCTSTR pszContainer, LPCTSTR pszProvider, unsigned int dwProvType, unsigned int dwKeySpec, B_KEY_OBJ *privateKey)
 Creates a Crypto-C B_KEY_OBJ from a CryptoAPI container name and key type. More...

int S_CERT_C_CAPI_ParsePrivateKeyObj (B_KEY_OBJ privateKey, LPTSTR *pszContainer, LPTSTR *pszProvider, unsigned int *dwProvType, unsigned int *dwKeySpec)
 Parses a Cert-C CryptoAPI KI_Token for a private key. More...

int S_CERT_C_CAPI_GetKeypair (LPCTSTR pszContainer, LPCTSTR pszProvider, unsigned int dwProvType, unsigned int dwKeySpec, B_KEY_OBJ *publicKey, B_KEY_OBJ *privateKey)
 Creates two Crypto-C B_KEY_OBJ objects from a CryptoAPI container name and key type. More...


Function Documentation

int S_CERT_C_CAPI_GetKeypair LPCTSTR    pszContainer,
LPCTSTR    pszProvider,
unsigned int    dwProvType,
unsigned int    dwKeySpec,
B_KEY_OBJ *    publicKey,
B_KEY_OBJ *    privateKey
;
 

Creates two Crypto-C B_KEY_OBJ objects from a CryptoAPI container name and key type. Call B_CreateKeyObject and B_SetKeyInfo on *privateKey and *publicKey. This function is specific to a Microsoft environment.

Parameters:
pszContainer This input parameter is the C string naming the key container.
pszProvider This input parameter is the C string naming the cryptographic service provider.
dwProvType This input parameter is the service provider type, such as PROV_RSA_FULL.
dwKeySpec This input parameter is the type of key within the container.
publicKey This output parameter is the resulting Crypto-C key object.
privateKey This output parameter is the resulting Crypto-C key object.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int S_CERT_C_CAPI_GetPrivateKeyObj LPCTSTR    pszContainer,
LPCTSTR    pszProvider,
unsigned int    dwProvType,
unsigned int    dwKeySpec,
B_KEY_OBJ *    privateKey
;
 

Creates a Crypto-C B_KEY_OBJ from a CryptoAPI container name and key type. Call B_CreateKeyObject and B_SetKeyInfo on *privateKey. This function is specific to a Microsoft environment.

Parameters:
pszContainer This input parameter is the C string naming the key container.
pszProvider This input parameter is the C string naming the cryptographic service provider.
dwProvType This input parameter is the service provider type, such as PROV_RSA_FULL.
dwKeySpec This input parameter is the type of key within the container.
privateKey This output parameter is the resulting Crypto-C key object.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int S_CERT_C_CAPI_GetPublicKeyObj LPCTSTR    pszContainer,
LPCTSTR    pszProvider,
unsigned int    dwProvType,
unsigned int    dwKeySpec,
B_KEY_OBJ *    publicKey
;
 

Creates a Crypto-C B_KEY_OBJ from a CryptoAPI container name and key type. Call B_CreateKeyObject and B_SetKeyInfo on *publicKey. This function is specific to a Microsoft environment.

Parameters:
pszContainer This input parameter is the C string naming the key container.
pszProvider This input parameter is the C string naming the cryptographic service provider.
dwProvType This input parameter is the service provider type, such as PROV_RSA_FULL.
dwKeySpec This input parameter is the type of key within the container.
publicKey This output parameter is the resulting Crypto-C key object.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int S_CERT_C_CAPI_ParsePrivateKeyObj B_KEY_OBJ    privateKey,
LPTSTR *    pszContainer,
LPTSTR *    pszProvider,
unsigned int *    dwProvType,
unsigned int *    dwKeySpec
;
 

Parses a Cert-C CryptoAPI KI_Token for a private key. The string pointers for the container and service provider names are set to locations within the key token that are freed when the key token is destroyed. The caller should not free them. This function is specific to a Microsoft environment.

Parameters:
privateKey This input parameter is the KI_Token Crypto-C key object to parse.
pszContainer This output parameter is a pointer to the C string naming the key container.
pszProvider This output parameter is a pointer to the C string naming the cryptographic service provider.
dwProvType This output parameter is a pointer to the service-provider type, such as PROV_RSA_FULL.
dwKeySpec This output parameter is a pointer to the type of key within the container.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int S_InitializeDefaultCSP CERTC_CTX    ctx,
POINTER    params,
SERVICE_FUNCS   funcs,
POINTER *    handle
;
 

The S_InitializeDefaultCSP() function is never called directly. Instead, to initialize or register the Cert-C Default Cryptographic service provider, call the C_InitializeCertC() or C_RegisterService() function. Both functions take SERVICE_HANDLER and a POINTER to a parameter ITEM as parameters. SERVICE_HANDLER's Initialize parameter points to the S_InitializeDefaultCSP() function, and the corresponding POINTER should point to a CRYPTO_PARAMS, or should be set it to NULL_PTR.

Cert-C uses S_InitializeDefaultCSP() to initialize the Cert-C Default Cryptographic service provider functions and initialization parameters. S_InitializeDefaultCSP() stores pointers to the Cert-C Default Cryptographic service provider functions in funcs's crypto member, which is a CRYPTO_FUNCS structure. S_InitializeDefaultCSP() uses the Cert-C Default Cryptographic service provider initialization parameters in params, which points to a CRYPTO_PARAMS.

Parameters:
ctx This input parameter points to an initialized Cert-C context handle.
params This input parameter can point to a CRYPTO_PARAMS, or it can be set to NULL_PTR.
funcs This is both an input and output parameter. As an input parameter, it points to an allocated but uninitialized SERVICE_FUNCS union. As an output parameter, it points to the initialized Cert-C Default Cryptographic service-provider-specific functions in SERVICE_FUNCS's crypto member, which is a CRYPTO_FUNCS structure.
handle This output parameter points to the service-provider handle for this instance of the Cert-C Default Cryptographic service provider.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.

int S_InitializeDefaultCSP2 CERTC_CTX    ctx,
POINTER    params,
SERVICE_FUNCS   funcs,
POINTER *    handle
;
 

Initializes the Cert-C Default Cryptographic service provider when the application needs to create a PKCS #11-enhanced session chooser. In this way, the Cert-C Default Cryptographic service provider gives your application access to a specified PKCS #11 hardware device and token, and the keys on the token.

The S_InitializeDefaultCSP2() function is never called directly. Instead, to initialize or register the Cert-C Default Cryptographic service provider, call the C_InitializeCertC() or C_RegisterService() function. Both functions take SERVICE_HANDLER and a POINTER to a parameter ITEM as parameters. SERVICE_HANDLER's Initialize parameter points to the S_InitializeDefaultCSP2() function, and the corresponding POINTER must point to a PKCS11_CRYPTO_PARAMS.

Cert-C uses S_InitializeDefaultCSP2() to initialize the Cert-C Default Cryptographic service provider functions and initialization parameters. S_InitializeDefaultCSP2() stores pointers to the Cert-C Default Cryptographic service provider functions in funcs's crypto member, which is a CRYPTO_FUNCS structure. S_InitializeDefaultCSP2() uses the Cert-C Default Cryptographic service provider initialization parameters in params, which points to a PKCS11_CRYPTO_PARAMS.

Parameters:
ctx This input parameter points to an initialized Cert-C context handle.
params This input parameter must point to a PKCS11_CRYPTO_PARAMS structure. PKCS11_CRYPTO_PARAMS contains PKCS #11 library and token information. Some of the B_PKCS11_SESSION values can be modified as a result of device initialization. For a detailed description of how values can be used and which can be modified, see B_CreateHardwareChooser in the RSA BSAFE Crypto-C Reference Manual.
funcs This is both an input and output parameter. As an input parameter, it points to an allocated but uninitialized SERVICE_FUNCS union. As an output parameter, it points to the initialized Cert-C Default Cryptographic service-provider-specific functions in SERVICE_FUNCS's crypto member, which is a CRYPTO_FUNCS structure.
handle This output parameter points to the service provider handle for this instance of the Cert-C Default Cryptographic service provider.
Returns:
If successful, returns 0. If not, returns a Cert-C error code.



RSA BSAFE® Cert-C 2.7 API Reference