Managing the life cycle of cryptographic keys in HSM.
See the HSM technical documentation.
Data Structures | |
struct | DN_EXPORT_BYOK_AZURE |
Settings and Macros | |
#define | D_IMPORT_ALG_PRIV_KEY_RSA (0xFFFFFFE1) /* Imports an RSA private key. */ |
#define | D_IMPORT_ALG_PRIV_KEY_ECC (0xFFFFFFE0) /* Imports an ECC private key (Elliptic Curves except ECX). */ |
#define | D_IMPORT_ALG_PRIV_KEY_P8 (0xFFFFDF) /* Import a key in P8 format */ |
#define | D_IMPORT_ALG_PRIV_KEY_ECX (0xFFFFDE) /* Import an ECX private key */ |
#define | DN_FORM_DER (1) |
#define | DN_BYOK_TYPE_AZURE (1) |
#define | DN_BYOK_TYPE_AWS (2) |
Functions | |
int AAP_API | DGenerateKey(HSESSIONCTX hSession, char *szKeyId, int nAlgId, DWORD dwFlags, HKEYCTX *phKey) |
int AAP_API | DGenerateKeyMaterial(HSESSIONCTX hSession, int nAlgId, BYTE *pbData, DWORD *pdwDataLen, DWORD dwReserved) |
int AAP_API | DGetUserKey(HSESSIONCTX hSession, char *szKeyId, DWORD dwFlags, HKEYCTX *phKey) |
int AAP_API | DImportKey(HSESSIONCTX hSession, char *szKeyId, HKEYCTX hKEKey, DWORD dwBlobType, int nAlgId, DWORD dwFlags, BYTE *pbData, DWORD dwDataLen, HKEYCTX *phKey) |
int AAP_API | DExportKey(HKEYCTX hKey, HKEYCTX hKEKey, DWORD dwBlobType, DWORD dwFlags, BYTE *pbData, DWORD *pdwDataLen) |
int AAP_API | DPKCS8ImportKey(HSESSIONCTX hSession, char *szKeyId, char *szSecret, DWORD dwKeyAlg, DWORD dwAttrib, BYTE *pbKeyEnvelope, DWORD dwKeyEnvelopeLen) |
int AAP_API | DPKCS8ExportKey(HSESSIONCTX hSession, char *szKeyId, char *szSecret, BYTE **ppbKeyEnvelope, DWORD *pdwKeyEnvelopeLen) |
int AAP_API | DSetKeyParam(HKEYCTX hKey, DWORD dwParam, BYTE *pbData, DWORD dwDataLen, DWORD dwFlags) |
int AAP_API | DGetKeyParam(HKEYCTX hKey, DWORD dwParam, BYTE *pbData, DWORD *pdwDataLen, DWORD dwFlags) |
int AAP_API | DDeriveKey(HHASHCTX hHash, char *szKeyId, int nAlgId, DWORD dwFlags, HKEYCTX *phKey) |
int AAP_API | DDuplicateKey(HKEYCTX hKey, DWORD dwFlags, HKEYCTX *phKey) |
int AAP_API | DHashSessionKey(HKEYCTX hKey, HHASHCTX hHash, DWORD dwFlags) |
int AAP_API | DDestroyKey(HKEYCTX *phKey, DWORD dwFlags) |
int AAP_API | DGeneratePKCS10CSR(HSESSIONCTX hSession, char *szPrivateKeyName, BYTE bVersion, char *szDN, DWORD dwOutType, DWORD *pdwCSRLen, BYTE **ppbCSR, DWORD dwParam) |
int AAP_API | DAssociatePKCS11Key(HSESSIONCTX hSession, char *szPriKey, char *szPubKey, char *szCert, void *pvReserved, DWORD dwReserved) |
int AAP_API | DExportPKCS12 (const HSESSIONCTX hSession, const char *szPkcs12Pwd, const char *szKeyId, const char *szCertId, const char *szReserved, BYTE **ppbPkcs12, DWORD *pdwPkcs12Len, DWORD dwFlags) |
int AAP_API | DImportPKCS12Buffer (const HSESSIONCTX hSession, BYTE *pbPkcs12, DWORD dwPkcs12Len, const char *szPkcs12Pwd, const char *szKeyId, DWORD dwKeyAttr, const char *szCertId, const char *szPubKeyId, DWORD dwFlags) |
int AAP_API | DImportPKCS12 (const HSESSIONCTX hSession, const char *szPkcs12File, const char *szPkcs12Pwd, const char *szKeyId, const DWORD dwKeyAttr, const char *szCertId) |
int AAP_API | DRSAPublicKey2Info(BYTE *pbKey, DWORD dwKeyLen, DWORD dwInForm, void *pvPubKeyInfo, DWORD dwReserved) |
int AAP_API | DRSAPrivateKey2Info (const BYTE *pbRsa, DWORD dwRsaLen, DWORD dwInForm, DN_RSA_PRIVATE_KEY_INFO *stRsaInfo, DWORD dwReserved) |
int AAP_API | DByokExport(HSESSIONCTX hSession, const char *cszKeyId, const char *cszKekId, DWORD dwType, const void *pvData, BYTE **ppbOutData, DWORD *pdwOutDataLen, DWORD dwReserved) |
#define D_IMPORT_ALG_PRIV_KEY_RSA (0xFFFFFFE1) /* Importa uma chave privada RSA. */ |
#include <dinamo.h>
#define D_IMPORT_ALG_PRIV_KEY_ECC (0xFFFFFFE0) /* Importa uma chave privada ECC(Curvas Elípticas com exceção de ECX). */ |
#include <dinamo.h>
#define D_IMPORT_ALG_PRIV_KEY_P8 (0xFFFFFFDF) /* Importa uma chave no formato P8 */ |
#include <dinamo.h>
#define D_IMPORT_ALG_PRIV_KEY_ECX (0xFFFFFFDE) /* Import uma chave privada ECX */ |
#include <dinamo.h>
#define DN_FORM_DER (1) |
#include <dinamo.h>
DER format.
#define DN_BYOK_TYPE_AZURE (1) |
#include <dinamo.h>
Export BYOK key to Azure.
#define DN_BYOK_TYPE_AWS (2) |
#include <dinamo.h>
Export BYOK key to AWS.
int AAP_API DGenerateKey | ( | HSESSIONCTX | hSession, |
char * | szKeyId, | ||
int | nAlgId, | ||
DWORD | dwFlags, | ||
HKEYCTX * | phKey ) |
#include <dinamo.h>
Creates and stores a cryptographic key associated with an algorithm according to the parameters entered, within the HSM.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[in] | szKeyId | Identifier of the key within the HSM. This identifier must not contain spaces or special characters. Uppercase and lowercase characters are case-sensitive. An object identifier in the HSM can have a maximum length, in characters, of MAX_OBJ_ID (including the terminator character). When creating keys in another user's partition (permission required) the name must be fully qualified with an FQN(Full Qualified Name: partition_id/obj_id), the maximum length for an FQN is MAX_OBJ_ID_FQN_LEN (including the terminator character). | ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[in] | nAlgId | Defines the algorithm associated with the cryptographic key to be generated. Symmetric Keys
RSA Asymmetric Keys
ECC Asymmetric Keys
ECX Asymmetric Keys
HMAC Keys
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[in] | dwFlags | Additional key parameters.
In addition to the values in the previous table, you can add a key usage profile definition. You can define the key usage profile (Attribute Usage-profile), using only one of the values below. If none of the values below are specified, the switch profile is set to free for any use. It is mandatory to define the usage profile when the HSM is in RM3.
| ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
[in] | phKey | Pointer to the context of the generated key. After use, it must be released with the DDestroyKey() function. NULL can be passed to not return the key context. |
Parameter | Value |
---|---|
Initialization Vector | It will be a vector with all bytes equal to zero and the same size as the key algorithm's operation block. |
Symmetric Encryption Mode of Operation | CBC (Cipher Block Chain) mode will be used |
Padding | The format defined in the PKCS#5 standard will be used for padding. |
Value | Block size |
---|---|
ALG_DES | 8 bytes |
ALG_3DES_112 | 8 bytes |
ALG_3DES_168 | 8 bytes |
ALG_AES_128 | 16 bytes |
ALG_AES_192 | 16 bytes |
ALG_AES_256 | 16 bytes |
ALG_ARC5 | 8 bytes |
int AAP_API DGenerateKeyMaterial | ( | HSESSIONCTX | hSession, |
int | nAlgId, | ||
BYTE * | pbData, | ||
DWORD * | pdwDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
It generates a cryptographic key and returns its contents. This operation generates a key using the HSM and returns the contents of the key without persisting the key in the HSM.
[in] | hSession | Context acquired through the DOpenSession() function. |
[in] | nAlgId | Defines the algorithm of the cryptographic key to be generated. This operation only supports symmetric key algorithms. See list of algorithms in DGenerateKey(). |
[in] | pbData | Buffer that will contain the generated key. NULL can be passed to receive the expected size of pbData in pdwDataLen. |
[in,out] | pdwDataLen | Pointer containing the size of the pbData buffer. This variable will contain the exact size of the data copied into pbData. If pbData is NULL or the size entered is not sufficient to complete the operation, pdwDataLen will contain the expected size of pbData. |
[in] | dwReserved | Reserved for future use. |
int AAP_API DGetUserKey | ( | HSESSIONCTX | hSession, |
char * | szKeyId, | ||
DWORD | dwFlags, | ||
HKEYCTX * | phKey ) |
#include <dinamo.h>
Retrieves the context of a key, as long as the current user has access, stored within the HSM. This function does not create a new key.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||
[in] | szKeyId | Identifier of the key within the HSM. This identifier must not contain spaces or special characters. Uppercase and lowercase characters are case-sensitive. See szKeyId in DGenerateKey() for details on maximum identifier sizes. | ||||||
[in] | dwFlags | Pass zero. Otherwise the following table is accepted.
| ||||||
[out] | phKey | Pointer to the context of the generated key. After use, it must be released with the DDestroyKey() function. |
int AAP_API DImportKey | ( | HSESSIONCTX | hSession, |
char * | szKeyId, | ||
HKEYCTX | hKEKey, | ||
DWORD | dwBlobType, | ||
int | nAlgId, | ||
DWORD | dwFlags, | ||
BYTE * | pbData, | ||
DWORD | dwDataLen, | ||
HKEYCTX * | phKey ) |
#include <dinamo.h>
Import a cryptographic key into the HSM. Keys can be permanent or temporary. Keys exported with the DExportKey() function can be imported without changing their format.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||||||||||||||
[in] | szKeyId | Identifier of the key within the HSM. This identifier must not contain spaces or special characters. Uppercase and lowercase characters are case-sensitive. See szKeyId in DGenerateKey() for details on maximum identifier sizes. | ||||||||||||||||||||||||||||
[in] | hKEKey | Context of the key with which the blob of the key to be imported is encrypted - KEK (key encryption key) | ||||||||||||||||||||||||||||
[in] | dwBlobType | Key buffer format in parameter pbData .
| ||||||||||||||||||||||||||||
[in] | nAlgId | Indicates the algorithm associated with the cryptographic key that will be generated. See list of algorithms in DGenerateKey(). Use D_IMPORT_ALG_PRIV_KEY_RSA when the imported private key is RSA and encrypted by KEK, the specific algorithm will be automatically detected by the HSM after opening the encrypted BLOB. | ||||||||||||||||||||||||||||
[in] | dwFlags | Additional key parameters. See the options in the DGenerateKey() function. | ||||||||||||||||||||||||||||
[in] | pbData | Buffer containing the key to be imported. | ||||||||||||||||||||||||||||
[in] | dwDataLen | Size of the data block with the key to be imported. | ||||||||||||||||||||||||||||
[out] | phKey | Pointer to the context of the generated key. After use, it must be released with the DDestroyKey function. |
SIMPLE_BLOB format:
EB = 00 || BT || PS || 00 || D
PRIVATEKEY_BLOB DER structures:
DER structure of PUBLICKEY_BLOB:
DER structure of PUBLICKEY_BLOB_X509:
int AAP_API DExportKey | ( | HKEYCTX | hKey, |
HKEYCTX | hKEKey, | ||
DWORD | dwBlobType, | ||
DWORD | dwFlags, | ||
BYTE * | pbData, | ||
DWORD * | pdwDataLen ) |
#include <dinamo.h>
Exports a key stored in the HSM so that it can be transported. The key can then be imported back into Dinamo with the DImportKey() function.
[in] | hKey | Context of the key to be exported. |
[in] | hKEKey | Context of the key with which the key block will be encrypted - KEK (key encryption key). |
[in] | dwBlobType | Key buffer format in parameter pbData . See parameter dwBlobType in DImportKey() for the list of types. |
[in] | dwFlags | Reserved for future use (must be 0). |
[in] | pbData | Buffer containing the key data according to the dwBlobType parameter. This parameter can be NULL to specify the amount of memory required. |
[in,out] | pdwDataLen | Pointer to the buffer size, in bytes, specified in pbData . When the function returns, this parameter will contain the size of the data stored in pbData . |
int AAP_API DPKCS8ImportKey | ( | HSESSIONCTX | hSession, |
char * | szKeyId, | ||
char * | szSecret, | ||
DWORD | dwKeyAlg, | ||
DWORD | dwAttrib, | ||
BYTE * | pbKeyEnvelope, | ||
DWORD | dwKeyEnvelopeLen ) |
#include <dinamo.h>
Imports an asymmetric RSA private key enveloped according to the PKCS#8 standard into the HSM. The RSA private key can be imported in clear text or protected by a digital envelope. For details on the standards, see the RSA Labs Public-Key Cryptography Standards (PKCS) documents. In the restricted operating modes (RM1 and RM2), RSA keys can only be imported via the PKCS#8 standard using a digital envelope, deriving an AES 256 key from a password of at least 01 character and no more than 16, and the derivation is done according to the PKCS#5 version 2.0 standard.
The envelope used can come from any system that adheres to the standards described.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||||||||||||||||||
[in] | szKeyId | Identifier for the RSA key that will be created in the HSM base. See szKeyId in DGenerateKey() for details on maximum identifier sizes. | ||||||||||||||||||||||||||||||
[in] | szSecret | Password used to derive the AES 256 key. Can be passed NULL for no password (import in clear text) or a password of no ND_MAX_P8_PWD_LEN characters plus null terminator. | ||||||||||||||||||||||||||||||
[in] | dwKeyAlg | Indicates the algorithm associated with the cryptographic key to be generated.
| ||||||||||||||||||||||||||||||
[in] | dwAttrib | Additional key parameters.
| ||||||||||||||||||||||||||||||
[in] | pbKeyEnvelope | Buffer containing the input PKCS#8 envelope. | ||||||||||||||||||||||||||||||
[in] | dwKeyEnvelopeLen | Size in bytes of the incoming PKCS#8 envelope. |
int AAP_API DPKCS8ExportKey | ( | HSESSIONCTX | hSession, |
char * | szKeyId, | ||
char * | szSecret, | ||
BYTE ** | ppbKeyEnvelope, | ||
DWORD * | pdwKeyEnvelopeLen ) |
#include <dinamo.h>
Exports an asymmetric RSA private key stored in the HSM according to the PKCS#8 standard. The RSA private key can be exported in clear text or protected by a digital envelope. For details on the standards, see the RSA Labs Public-Key Cryptography Standards (PKCS) documents. In restricted operating modes (RM1 and RM2), exportable RSA keys can only be exported via the PKCS#8 standard using a digital envelope, deriving an AES 256 key from a password between ND_MIN_P8_PWD_LEN and ND_MAX_P8_PWD_LEN characters in length, and the derivation is done according to the PKCS#5 version 2.0 standard. The output envelope can be imported into any system that adheres to the standards described.
[in] | hSession | Context acquired through the DOpenSession() function. |
[in] | szKeyId | Identifier of the RSA key to be exported. See szKeyId in DGenerateKey() for details on maximum identifier sizes. |
[in] | szSecret | Password with a length between ND_MIN_P8_PWD_LEN and ND_MAX_P8_PWD_LEN plus null terminator, used to derive the AES 256 key. NULL can be passed to export in clear text, without a password. |
[out] | ppbKeyEnvelope | Pointer that will contain the outgoing PKCS#8 envelope. Memory allocation is done internally by the library. The calling application is responsible for freeing the allocated memory. The DFree() function must be used to free this buffer. |
[out] | pdwKeyEnvelopeLen | Pointer to DWORD that will contain the size in bytes of the outgoing PKCS#8 envelope. |
int AAP_API DSetKeyParam | ( | HKEYCTX | hKey, |
DWORD | dwParam, | ||
BYTE * | pbData, | ||
DWORD | dwDataLen, | ||
DWORD | dwFlags ) |
#include <dinamo.h>
Changes the parameters of key contexts which, in general, will influence their manipulation.
[in] | hKey | Context of the key to be exported. | ||||||||||||||
[in] | dwParam | Defines the operation that will be performed and consequently the structure or data passed in the parameter pbData .
| ||||||||||||||
[in] | pbData | Pointer to the data or structures specified in dwParam . | ||||||||||||||
[in] | dwDataLen | Size of data or structure specified in dwParam . | ||||||||||||||
[in] | dwFlags | REMOVE_ATTRIBUTE can be used to remove a user's privilege on a key. This flag should only be used in conjunction with DKP_OWNER or DKP_USER. |
int AAP_API DGetKeyParam | ( | HKEYCTX | hKey, |
DWORD | dwParam, | ||
BYTE * | pbData, | ||
DWORD * | pdwDataLen, | ||
DWORD | dwFlags ) |
#include <dinamo.h>
Retrieves parameters from key contexts.
[in] | hKey | Context of the key to be exported | ||||||||||||||||
[in] | dwParam | Defines the operation that will be performed and consequently the structure or data passed in the parameter pbData . All values described in DSetKeyParam() and more:
| ||||||||||||||||
[in] | pbData | Pointer to the data or structures specified in dwParam | ||||||||||||||||
[in] | pdwDataLen | Size of data or structure specified in dwParam | ||||||||||||||||
[in] | dwFlags | Reserved for future use (must be 0). |
int AAP_API DDeriveKey | ( | HHASHCTX | hHash, |
char * | szKeyId, | ||
int | nAlgId, | ||
DWORD | dwFlags, | ||
HKEYCTX * | phKey ) |
#include <dinamo.h>
Derives a key from the hash entered. If the hash is not yet complete, it will be finalized and its value used as a symmetric key.
[in] | hHash | Hash context created with DCreateHash. |
[in] | szKeyId | Identifier of the key within the HSM. This identifier must not contain spaces or special characters. Uppercase and lowercase characters are case-sensitive. See szKeyId in DGenerateKey() for details on maximum identifier sizes. |
[in] | nAlgId | Indicates the algorithm associated with the cryptographic key that will be generated. See list of algorithms in DGenerateKey(). |
[in] | dwFlags | Additional key parameters. See list of additional key parameters in DGenerateKey(). |
[in] | phKey | Pointer to the context of the generated key. After use, it must be released with the DDestroyKey() function. |
#include <dinamo.h>
Duplicates the context of a key, including its internal state.
[in] | hKey | Key context. |
[in] | dwFlags | Reserved for future use (must be 0). |
[out] | phKey | Pointer to the context of the generated key. After use, it must be released with the DDestroyKey() function. |
#include <dinamo.h>
Uses the value of a symmetric key as input data for the execution of a hash. The hash context must have a clean context in order to be used in this function, i.e. it cannot have been used with the DHashData() function.
[in] | hKey | Key context. |
[in] | hHash | Hash context created with DCreateHash(). |
[in] | dwFlags | Reserved for future use (must be 0). |
#include <dinamo.h>
Releases the context of a key after it has been used. Once this context has been released, it can no longer be used by any function and becomes invalid.
[in] | phKey | Pointer to a key context that will be released. | ||||
[in] | dwFlags | Operation modifiers.
|
int AAP_API DGeneratePKCS10CSR | ( | HSESSIONCTX | hSession, |
char * | szPrivateKeyName, | ||
BYTE | bVersion, | ||
char * | szDN, | ||
DWORD | dwOutType, | ||
DWORD * | pdwCSRLen, | ||
BYTE ** | ppbCSR, | ||
DWORD | dwParam ) |
#include <dinamo.h>
Generates a CSR (Certificate Signing Request). This is a specialized function of HSM's PKCS#10 CSR generation API.
[in] | hSession | Context acquired through the DOpenSession() function. | ||||||||||||||
[in] | szPrivateKeyName | Private key identifier. | ||||||||||||||
[in] | bVersion | CSR version PKCS#10. The following table is supported.
| ||||||||||||||
[in] | szDN | DN (Dinstinguished Name), for generating the CSR, with a maximum size of CORE_P10_CSR_DN_MAX_LEN. DN fields must be separated by '/'. | ||||||||||||||
[in] | dwOutType | CSR output type. The following table is supported.
| ||||||||||||||
[out] | pdwCSRLen | Pointer to the size of the buffer allocated in ppbCSR. | ||||||||||||||
[out] | ppbCSR | Pointer that will receive the CSR. The size of the allocated buffer will be available via pdwCSRLen. Memory allocation is done internally. The calling application is responsible for freeing the allocated memory using the DFree() API. | ||||||||||||||
[in] | dwParam | Additional parameters. The following table is supported.
|
int AAP_API DAssociatePKCS11Key | ( | HSESSIONCTX | hSession, |
char * | szPriKey, | ||
char * | szPubKey, | ||
char * | szCert, | ||
void * | pvReserved, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
It associates a private key with a certificate and optionally a public key following the PKCS#11 Base v2.40 section 4.6.3 specifications and the one used by Firefox.
[in] | hSession | Context acquired through the DOpenSession() function. . |
[in] | szPriKey | Name of the private key to be associated. |
[in] | szPubKey | Name of the public key to be associated. You can pass NULL to avoid generating the associated public key. Must be related to the private key. |
[in] | szCert | Name of the certificate to be exported. It must be related to the private key. |
[in] | pvReserved | Reserved for future use. Must be NULL. |
[in] | dwReserved | Reserved for future use. Must be 0. |
Attribute | Value |
---|---|
CKA_ID | SHA1 of the public key module. Set for Private key, public key and certificate. |
CKA_LABEL | Certificate id. Defined for private key and certificate. |
CKA_SUBJECT | Subject retrieved from certificate. Defined for private key and certificate. |
In the case of EC keys, the CKA_ID will be the SHA1 hash of the CKA_PUBLIC_KEY_INFO value.
int AAP_API DExportPKCS12 | ( | const HSESSIONCTX | hSession, |
const char * | szPkcs12Pwd, | ||
const char * | szKeyId, | ||
const char * | szCertId, | ||
const char * | szReserved, | ||
BYTE ** | ppbPkcs12, | ||
DWORD * | pdwPkcs12Len, | ||
DWORD | dwFlags ) |
#include <dinamo.h>
Exports a private key and an RSA certificate in PKCS#12 format.
[in] | hSession | Context acquired through the DOpenSession() function. . | ||||
[in] | szPkcs12Pwd | Password for PKCS#12 file. Pass NULL to generate PKCS#12 without password. | ||||
[in] | szKeyId | Name of the private key to be exported. See szKeyId in DGenerateKey() for details on maximum identifier sizes. | ||||
[in] | szCertId | Name of the certificate to be exported. It must be related to the private key. | ||||
[in] | szReserved | Reserved for future use. Must be NULL. | ||||
[out] | ppbPkcs12 | Pointer to a pointer that will contain the generated PKCS#12. This data area will be allocated internally and must be freed using DFree(). | ||||
[out] | pdwPkcs12Len | Pointer to the size of the data written in ppbPkcs12 . | ||||
[in] | dwFlags | Pass 0 or one of the options in the table below.
|
int AAP_API DImportPKCS12Buffer | ( | const HSESSIONCTX | hSession, |
BYTE * | pbPkcs12, | ||
DWORD | dwPkcs12Len, | ||
const char * | szPkcs12Pwd, | ||
const char * | szKeyId, | ||
DWORD | dwKeyAttr, | ||
const char * | szCertId, | ||
const char * | szPubKeyId, | ||
DWORD | dwFlags ) |
#include <dinamo.h>
Imports a private/public key and a certificate from a buffer in PKCS#12 format.
[in] | hSession | Context acquired through the DOpenSession() function. . |
[in] | pbPkcs12 | PKCS#12 that will be imported. |
[in] | dwPkcs12Len | Size of the buffer containing PKCS#12 in pbPkcs12 . |
[in] | szPkcs12Pwd | Password for PKCS#12. Pass NULL in case there is no password. |
[in] | szKeyId | Name of the private key to be imported. See szKeyId in DGenerateKey() for details on maximum identifier sizes. |
[in] | dwKeyAttr | Attributes of the private key to be imported See dwFlags in DGenerateKey() for details on the key attributes. |
[in] | szCertId | Name of the certificate to be imported. It must be related to the private key. |
[in] | szPubKeyId | Name of the public key that can be imported. Can be NULL if you don't want the public key to be imported. |
[in] | dwFlags | Reserved for future use. Must be 0. |
int AAP_API DImportPKCS12 | ( | const HSESSIONCTX | hSession, |
const char * | szPkcs12File, | ||
const char * | szPkcs12Pwd, | ||
const char * | szKeyId, | ||
const DWORD | dwKeyAttr, | ||
const char * | szCertId ) |
#include <dinamo.h>
Imports a private/public key and a certificate from a file in PKCS#12 format.
[in] | hSession | Context acquired through the DOpenSession() function. . |
[in] | szPkcs12File | Name of the PKCS#12 file to be imported. |
[in] | szPkcs12Pwd | Password for PKCS#12. Pass NULL in case there is no password. |
[in] | szKeyId | Name of the private key to be imported. See szKeyId in DGenerateKey() for details on maximum identifier sizes. |
[in] | dwKeyAttr | Attributes of the private key to be imported See dwFlags in DGenerateKey() for details on the key attributes. |
[in] | szCertId | Name of the certificate to be imported. It must be related to the private key. |
int AAP_API DRSAPublicKey2Info | ( | BYTE * | pbKey, |
DWORD | dwKeyLen, | ||
DWORD | dwInForm, | ||
void * | pvPubKeyInfo, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Decrypts the information in an RSA public key. Accepts public keys in PKCS#1 RSAPublicKey or X.509 SubjectPublicKeyInfo format.
[in] | pbKey | Public key. | ||||
[in] | dwKeyLen | Buffer size pbKey . | ||||
[in] | dwInForm | Key entry format in pbKey . The table below is accepted.
| ||||
[out] | pvPubKeyInfo | Pointer to a DN_RSA_PUB_KEY_INFO structure. | ||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DRSAPrivateKey2Info | ( | const BYTE * | pbRsa, |
DWORD | dwRsaLen, | ||
DWORD | dwInForm, | ||
DN_RSA_PRIVATE_KEY_INFO * | stRsaInfo, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Decrypts the information in an RSA private key. Accepts private keys in PKCS#1 RSAPrivateKey or PKCS#8 PrivateKeyInfo format without encryption.
[in] | pbRsa | Private key. | ||||
[in] | dwRsaLen | Buffer size pbRsa . | ||||
[in] | dwInForm | Key entry format in pbRsa . The table below is accepted.
| ||||
[out] | stRsaInfo | Pointer to a DN_RSA_PRIVATE_KEY_INFO structure. | ||||
[in] | dwReserved | Reserved for future use (must be 0). |
int AAP_API DByokExport | ( | HSESSIONCTX | hSession, |
const char * | cszKeyId, | ||
const char * | cszKekId, | ||
DWORD | dwType, | ||
const void * | pvData, | ||
BYTE ** | ppbOutData, | ||
DWORD * | pdwOutDataLen, | ||
DWORD | dwReserved ) |
#include <dinamo.h>
Export a key in BYOK (Bring Your Own Key) format to a cloud provider.
[in] | hSession | Session context. | ||||||
[in] | cszKeyId | Identifier of the key to be exported. See szKeyId in DGenerateKey() for details on maximum identifier sizes. | ||||||
[in] | cszKekId | Identifier of the KEK key that will be used to encrypt the key that will be exported. | ||||||
[in] | dwType | Type of export. The table below is accepted.
| ||||||
[in] | pvData | Pointer to a specific data structure for each type of export. See dwType for details. | ||||||
[out] | ppbOutData | Pointer to a pointer that will contain the output data. This data area will be allocated internally and must be freed using DFree(). | ||||||
[out] | pdwOutDataLen | Pointer to the size of the data written in ppbOutData . | ||||||
[in] | dwReserved | Reserved for future use (must be 0). |