15 Oracle Key Vault Client SDK Utility APIs

You can use the Oracle Key Vault client SDK utility APIs with other Oracle Key Vault functions to simplify common operations.

The element and attribute index used in the Oracle Key Vault utility functions have the same meaning as described in section Attribute Index and Element Index.

15.1 About the Oracle Key Vault Client SDK Utility APIs

You can use the Oracle Key Vault SDK utility APIs with other Oracle Key Vault APIs to simplify commonly used operations.

The client SDK utility API element and attribute indexes have the same structure as the Oracle Key Vault KMIP attribute APIs.

15.2 okvAttrExtractTTLV

okvAttrExtractTTLV converts the attributes that are child OKVTTLV objects of the specified OKVTTLV parent object into OKVAttr.

Category

KMIP utility API

Purpose

okvAttrExtractTTLV will convert the attributes that are child OKVTTLV objects of the specified OKVTTLV parent object into OKVAttr.

Syntax

OKVErrNo okvAttrExtractTTLV(OKVEnv *env, OKVTTLV *attr_ttlv,
                            OKVAttr *attr_col);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
attr_ttlv IN

TTLV parent object containing attributes.

attr_col OUT

Collection of attributes.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Comments

None.

Example

OKVAttr attr_struct;
ub4 index = 0;
memset((void *)&attr_struct, 0, sizeof(attr_struct));
...
okvAttrExtractTTLV(env, ttlv, &attr_struct);
printf("\nAttributes Extracted:");
printf("\nName: %s ", attr_struct.name[index].name);
printf("\nName Length: %d ", attr_struct.name[index].namel);

/* Null terminate the unique identifier */
attr_struct.unique_identifier.id[attr_struct.unique_identifier.idl] = 0;
printf("\nUnique ID: %s ", attr_struct.unique_identifier.id);
printf("\nUnique ID Length: %d ", attr_struct.unique_identifier.idl);
printf("\nCryptographic Algorithm: %d ", attr_struct.crypto_algorithm);

Related Topics

15.3 okvAttrMakeTTLV

okvAttrMakeTTLV converts the OKVAttr into an OKVTTLV structure.

Category

KMIP utility API

Purpose

okvAttrMakeTTLV will convert the OKVAttr into an OKVTTLV structure and all the new attributes in the OKVTTLV will be collected under the specified OKVTTLV parent object.

Syntax

OKVErrNo okvAttrMakeTTLV(OKVEnv *env, OKVAttr *attr_col  
                         OKVTTLV *attr_ttlv);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
attr_col IN

Collection of attributes.

attr_ttlv OUT

TTLV parent object containing attributes.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Comments

For multi-instance attributes, the count of the attribute must be set. For example, name is a multi-instance attribute. Hence, if name is being added, name_count must also be specified.

Example

OKVTTLV *ttlv = (OKVTTLV *)NULL;
OKVOps *ops;
OKVAttr attrs;
memset((void *)&attrs, 0, sizeof(attrs));
...

/* Adding name attribute to the structure */
ub4 index = 0;
attrs.name_count = 1;
attrs.name[index].name = "attr_name";
attrs.name[index].namel = strlen(attrs.name[index].name);
attrs.name[index].type = 1;
 
/* Adding cryptographic algo attribute to the structure */
attrs.crypto_algorithm = CRYPTO_ALG_AES;

/* Adding unique identifier attribute to the structure */
attrs.unique_identifier.id = uid;
attrs.unique_identifier.idl = strlen(attrs.unique_identifier.id);
ops = okvOpsCreate(env, OKVOpAddAttribute);
ttlv = okvTTLVGetRequest(env, ops);

/* Convert OKVAttr structure to TTLV Attributes Object */
okvAttrMakeTTLV(env, &attrs, ttlv);

Related Topics

15.4 okvCryptoContextCreate

okvCryptoContextCreate creates the cryptographic context required for cryptographic operations.

Category

KMIP utility API

Purpose

okvCryptoContextCreate creates the cryptographiccontext required for cryptographic operations OR encrypt, decrypt, sign, and signature verify operations.

Syntax

OKVCryptoContext *okvCryptoContextCreate(OKVEnv *env, OKVOpsNo operation);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

operation

IN

KMIP operation.

Return Values

Return Value Description
OKVCryptoContext *

Pointer to OKVCryptoContext object.

Success: Pointer to OKVCryptoContext object.

Failure: NULL pointer.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);

Related Topics

15.5 okvCryptoContextFree

okvCryptoContextFree frees the memory allocated to cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextFree frees the memory allocated to cryptographic context structure.

Syntax

void okvCryptoContextFree(OKVEnv *env, OKVCryptoContext** crypto_context);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for cryptographic operations.

Return Values

No values returned.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
...
okvCryptoContextFree(env, &crypto_context);

Related Topics

15.6 okvCryptoContextGetAuthEncryptionAdditionalData

okvCryptoContextGetAuthEncryptionAdditionalData gets the authenticated encryption additional data parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetAuthEncryptionAdditionalData gets the Authenticated encryption additional data parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetAuthEncryptionAdditionalData(OKVEnv *env,
                                                         OKVCryptoContext *crypto_context,
                                                         ub1 *auth_encryption_additional_data,
                                                         ub4 *auth_encryption_additional_datal);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

auth_encryption_additional_data

OUT

Authenticated encryption additional data value.

auth_encryption_additional_datal

OUT

Authenticated encryption additional data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 *auth_enc_addl_data = (ub1 *)NULL;
ub4 auth_enc_addl_datal = 0;
okvCryptoContextGetAuthEncryptionAdditionalData (env, crypto_context,
                                                 auth_enc_addl_data,
                                                 &auth_enc_addl_datal);

15.7 okvCryptoContextGetAuthEncryptionTag

okvCryptoContextGetAuthEncryptionTag gets the authenticated encryption tag parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetAuthEncryptionTag gets the Authenticated encryption tag parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetAuthEncryptionTag(OKVEnv *env,
                                              OKVCryptoContext *crypto_context,
                                              ub1 *auth_encryption_tag,
                                              ub4 *auth_encryption_tagl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

auth_encryption_tag

OUT

Authenticated encryption tag value.

auth_encryption_tagl

OUT

Authenticated encryption tag value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 *auth_enc_tag = (ub1 *)NULL;
ub4 auth_enc_tagl = 0;
okvCryptoContextGetAuthEncryptionTag(env, crypto_context,
                                     auth_enc_tag, &auth_enc_tagl);

15.8 okvCryptoContextGetBlockCipherMode

okvCryptoContextGetBlockCipherMode gets the block cipher mode parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetBlockCipherMode gets the block cipher mode parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetBlockCipherMode(OKVEnv *env,
                                            OKVCryptoContext *crypto_context,
                                            ub4 *block_cipher_mode);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

block_cipher_mode

OUT

Block Cipher Mode value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub4 block_cipher_mode;
okvCryptoContextGetBlockCipherMode(env, crypto_context, &block_cipher_mode);

15.9 okvCryptoContextGetIV

okvCryptoContextGetIV gets the IV parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetIV gets the IV parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetIV(OKVEnv *env,
                               OKVCryptoContext *crypto_context,
                               ub1 *iv, ub4 *ivl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

iv

OUT

IV value.

ivl

OUT

IV value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 *iv = (ub1 *)NULL;
ub4 ivl = 0;
okvCryptoContextGetIV(env, crypto_context, iv, &ivl);

Related Topics

15.10 okvCryptoContextGetPadding

okvCryptoContextGetPadding gets the padding parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetPadding gets the padding parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetPadding(OKVEnv *env,
                                    OKVCryptoContext *crypto_context,
                                    ub4 *padding);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for cryptographic operations.

padding

OUT

Padding value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub4 padding;
okvCryptoContextGetPadding(env, crypto_context, &padding);

15.11 okvCryptoContextGetRandomIV

okvCryptoContextGetRandomIV gets the random IV parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetRandomIV gets the random IV parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetRandomIV(OKVEnv *env,
                                     OKVCryptoContext *crypto_context,
                                     ub8 *random_iv);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

random_iv

OUT

Random IV value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub8 random_iv;
okvCryptoContextGetRandomIV(env, crypto_context, &random_iv);

15.12 okvCryptoContextSetAuthEncryptionAdditionalData

okvCryptoContextSetAuthEncryptionAdditionalData sets the authenticated encryption additional data parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetAuthEncryptionAdditionalData sets the Authenticated encryption additional data parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetAuthEncryptionAdditionalData(OKVEnv *env,
                                                         OKVCryptoContext *crypto_context,
                                                         ub1 *auth_encryption_additional_data,
                                                         ub4 auth_encryption_additional_datal);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

auth_encryption_additional_data

IN

Authenticated encryption additional data value.

auth_encryption_additional_datal

IN

Authenticated encryption additional data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
ub1 auth_enc_addl_data[] = "Additional Data";
ub4 auth_enc_addl_datal = strlen((const char *) auth_enc_addl_data);
okvCryptoContextSetAuthEncryptionAdditionalData(env, crypto_context, auth_enc_addl_data,
                                                auth_enc_addl_datal);

15.13 okvCryptoContextSetAuthEncryptionTag

okvCryptoContextSetAuthEncryptionTag sets the authenticated encryption tag parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetAuthEncryptionTag sets the Authenticated encryption tag parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetAuthEncryptionTag(OKVEnv *env,
                                              OKVCryptoContext *crypto_context,
                                              ub1 *auth_encryption_tag,
                                              ub4 auth_encryption_tagl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

auth_encryption_tag

IN

Authenticated encryption tag value.

auth_encryption_tagl

IN

Authenticated encryption tag value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
ub1 auth_enc_tag[] = "Auth Tag";
ub4 auth_enc_tagl = strlen((const char *) auth_enc_tag);
okvCryptoContextSetAuthEncryptionTag(env, crypto_context, auth_enc_tag, auth_enc_tagl);

15.14 okvCryptoContextSetBlockCipherMode

okvCryptoContextSetBlockCipherMode sets the block cipher mode parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetBlockCipherMode sets the block cipher mode parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetBlockCipherMode(OKVEnv *env,
                                            OKVCryptoContext *crypto_context,
                                            ub4 block_cipher_mode);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

block_cipher_mode

IN

Block Cipher Mode value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
okvCryptoContextSetBlockCipherMode(env, crypto_context, BLK_CIPHER_CBC);

15.15 okvCryptoContextSetIV

okvCryptoContextSetIV sets the IV parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetIV sets the IV parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetIV(OKVEnv *env,
                               OKVCryptoContext *crypto_context,
                               ub1 *iv, ub4 ivl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

iv

IN

IV value.

ivl

IN

IV value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
ub1 iv[] = "5432109876543210";
ub4 ivl = strlen((const char *) iv);
okvCryptoContextSetIV(env, crypto_context, iv, ivl);

Related Topics

15.16 okvCryptoContextSetPadding

okvCryptoContextSetPadding sets the padding parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetPadding sets the padding parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetPadding(OKVEnv *env,
                                    OKVCryptoContext *crypto_context,
                                    ub4 padding);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for cryptographic operations like cryptographic parameters and IV.

padding

IN

Padding value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
okvCryptoContextSetPadding(env, crypto_context, PADDING_PKCS5);

15.17 okvCryptoContextSetRandomIV

okvCryptoContextSetRandomIV sets the random IV parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetRandomIV sets the random IV parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetRandomIV(OKVEnv *env,
                                     OKVCryptoContext *crypto_context,
                                     ub8 random_iv);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context

IN

Cryptographic context contains required parameters for encryption/decryption like cryptographic parameters and IV.

random_iv

IN

Random IV value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpEncrypt);
okvCryptoContextSetRandomIV(env, crypto_context, (ub8)1);

15.18 okvCryptoResponseGetAuthEncryptionTag

okvCryptoResponseGetAuthEncryptionTag gets the authenticated encryption tag value from encrypt response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetAuthEncryptionTag gets the Authenticated encryption tag value from encrypt response structure.

Syntax

OKVErrNo okvCryptoResponseGetAuthEncryptionTag(OKVEnv *env,
                                               OKVEncryptResponse *encrypt_response,
                                               ub1 *auth_encryption_tag,
                                               ub4 *auth_encryption_tagl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

encrypt_response

IN

Encrypt operation response.

auth_encryption_tag

OUT

Authenticated encryption tag value.

auth_encryption_tagl

OUT

Authenticated encryption tag value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 auth_enc_tag[100];
ub4 auth_enc_tagl = sizeof(auth_enc_tag);
...
/* Perform Encrypt operation and get encrypt operation response in 'encrypt_response' */
...
memset(auth_enc_tag, 0, auth_enc_tagl);
okvCryptoResponseGetAuthEncryptionTag(env, encrypt_response, auth_enc_tag, &auth_enc_tagl);

15.19 okvCryptoResponseGetDecryptedData

okvCryptoResponseGetDecryptedData gets the decrypted data value from decrypt response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetDecryptedData gets the decrypted data value from decrypt response structure.

Syntax

OKVErrNo okvCryptoResponseGetDecryptedData(OKVEnv *env,
                                           OKVDecryptResponse *decrypt_response,
                                           ub1 *decrypted_data,
                                           ub4 *decrypted_datal);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

decrypt_response

IN

Decrypt operation response.

decrypted_data

OUT

Decrypted data value.

decrypted_datal

OUT

Decrypted data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 decrypted_data[100];
ub4 decrypted_datal = sizeof(decrypted_data);
...
/* Perform Decrypt operation and get decrypt operation response in 'decrypt_response' */
...
memset(decrypted_data, 0, decrypted_datal);
okvCryptoResponseGetDecryptedData(env, decrypt_response, decrypted_data, &decrypted_datal);

15.20 okvCryptoResponseGetEncryptedData

okvCryptoResponseGetEncryptedData gets the encrypted data value from encrypt response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetEncryptedData gets the encrypted data value from encrypt response structure.

Syntax

OKVErrNo okvCryptoResponseGetEncryptedData(OKVEnv *env,
                                           OKVEncryptResponse *encrypt_response,
                                           ub1 *encrypted_data, ub4 *encrypted_datal);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

encrypt_response

IN

Encrypt operation response.

encrypted_data

OUT

Encrypted data value.

encrypted_datal

OUT

Encrypted data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 encrypted_data[100];
ub4 encrypted_datal = sizeof(encrypted_data);
...
/* Perform Encrypt operation and get encrypt operation response in 'encrypt_response' */
...
memset(encrypted_data, 0, encrypted_datal);
okvCryptoResponseGetEncryptedData(env, encrypt_response, encrypted_data, &encrypted_datal);

15.21 okvCryptoResponseGetIV

okvCryptoResponseGetIV gets the IV value from encrypt response structure used by server for encryption, if the random IV was set and IV was not provided in the request.

Category

KMIP utility API

Purpose

okvCryptoResponseGetIV gets the IV value from encrypt response structure used by server for encryption, if the random IV was set and IV was not provided in the request.

Syntax

OKVErrNo okvCryptoResponseGetIV(OKVEnv *env,
                                OKVEncryptResponse *encrypt_response,
                                ub1 *iv, ub4 *ivl);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

encrypt_response

IN

Encrypt operation response.

iv

OUT

IV value.

ivl

OUT

IV value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0) is returned.

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

ub1 iv[100];
ub4 ivl = sizeof(iv);
...
/* Perform Encrypt operation and get encrypt operation response in 'encrypt_response' */
...
memset(iv, 0, ivl);
okvCryptoResponseGetIV(env, encrypt_response, iv, &ivl);

15.22 okvDecryptResponseCreate

okvDecryptResponseCreate creates the decrypt response structure to hold the decrypt operation response details.

Category

KMIP utility API

Purpose

okvDecryptResponseCreate creates the decrypt response structure to hold the decrypt operation response details.

Syntax

OKVDecryptResponse *okvDecryptResponseCreate(OKVEnv *env);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

Return Values

Return Value Description
OKVDecryptResponse *

Pointer to OKVDecryptResponse object.

Success: Pointer to OKVDecryptResponse object.

Failure: NULL pointer.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVDecryptResponse *decrypt_response = okvDecryptResponseCreate(env);

15.23 okvDecryptResponseFree

okvDecryptResponseFree frees the memory allocated to decrypt response structure.

Category

KMIP utility API

Purpose

okvDecryptResponseFree frees the memory allocated to decrypt response structure.

Syntax

void okvDecryptResponseFree(OKVEnv *env, OKVDecryptResponse** decrypt_response);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

decrypt_response

IN

Decrypt operation response.

Return Values

No values returned.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVDecryptResponse *decrypt_response = okvDecryptResponseCreate(env);
...
okvDecryptResponseFree(env, &decrypt_response);

15.24 okvEncryptResponseCreate

okvEncryptResponseCreate creates the encrypt response structure to hold the encrypt operation response details.

Category

KMIP utility API

Purpose

okvEncryptResponseCreate creates the encrypt response structure to hold the encrypt operation response details.

Syntax

OKVEncryptResponse *okvEncryptResponseCreate(OKVEnv *env);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

Return Values

Return Value Description
OKVEncryptResponse *

Pointer to OKVEncryptResponse object.

Success: Pointer to OKVEncryptResponse object.

Failure: NULL pointer.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVEncryptResponse *encrypt_response = okvEncryptResponseCreate(env);

15.25 okvEncryptResponseFree

okvEncryptResponseFree frees the memory allocated to encrypt response structure.

Category

KMIP utility API

Purpose

okvEncryptResponseFree frees the memory allocated to encrypt response structure.

Syntax

void okvEncryptResponseFree(OKVEnv *env, OKVEncryptResponse** encrypt_response);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

encrypt_response

IN

Encrypt operation response.

Return Values

No values returned.

Supported Versions

Oracle Key Vault C SDK release 21.4.0.0.0 and later.

Comments

None.

Example

OKVEncryptResponse *encrypt_response = okvEncryptResponseCreate(env);
...
okvEncryptResponseFree(env, &encrypt_response);

15.26 okvGetTextForAttributeNum

okvGetTextForAttributeNum returns the attribute name for a given Oracle Key Vault attribute number.

Category

KMIP Utility API

Purpose

okvGetTextForAttributeNum returns the attribute name for a given Oracle Key Vault attribute number.

Syntax

oratext *okvGetTextForAttributeNum(OKVAttrNo attrno);

Parameters

Parameter IN/OUT Description
attrno

IN

Oracle Key Vault attribute number of the KMIP attribute.

Return Values

Return Value Description
oratext*

Name of KMIP attribute.

Success: A valid pointer to the name of the KMIP attribute.

Failure: A NULL pointer is returned.

Comments

None.

Example

printf("%s", okvGetTextForAttributeNum(OKVAttrActivationDate));

15.27 okvGetTextForTag

okvGetTextForTag returns the name of the valid KMIP tag.

Category

KMIP utility API

Purpose

okvGetTextForTag returns the name of the valid KMIP tag. A NULL value is returned for invalid KMIP tag.

Syntax

oratext *okvGetTextForTag(OKVTag tag); 

Parameters

Parameter IN/OUT Description
tag IN KMIP tag

Return Values

Return Value Description
oratext*

KMIP tag name.

Success: A valid pointer to the KMIP tag name is returned.

Failure: A NULL pointer is returned.

Comments

None.

Example

printf("%s", okvGetTextForTag(OKVDEF_TAG_ID));

15.28 okvGetTextForTagEnum

okvGetTextForTagEnum returns the name of the enumerated value for a valid KMIP tag of ENUMERATION type.

Category

KMIP utility API

Purpose

okvGetTextForTagEnum will return the name of the enumerated value for a valid KMIP tag of EMUMERATION type.

Syntax

oratext *okvGetTextForTagEnum(OKVTag tag, ub4 val); 

Parameters

Parameter IN/OUT Description
tag IN KMIP enum tag
val IN KMIP enum tag value

Return Values

Return Value Description
oratext*

Name of KMIP enum tag value.

Success: A valid pointer to the name of the KMIP enum tag value is returned.

Failure: A NULL pointer is returned.

Comments

A NULL value is returned for invalid KMIP tag or invalid value of the KMIP tag or if the KMIP tag is not of ENUMERATION type.

Example

printf("%s", okvGetTextForTagEnum(OKVDEF_TAG_STATE, OKVDEF_STATE_ACTIVE));

15.29 okvGetTextForTagType

okvGetTextForTagType returns the name of the valid KMIP type.

Category

KMIP utility API

Purpose

okvGetTextForTagType returns the name of the valid KMIP type. A NULL value is returned for invalid KMIP type.

Syntax

oratext *okvGetTextForTagType(OKVType typ); 

Parameters

Parameter IN/OUT Description
typ IN KMIP type

Return Values

Return Value Description
oratext*

KMIP type name.

Success: A valid pointer to the KMIP type name is returned.

Failure: A NULL pointer is returned.

Comments

None.

Example

printf("%s", okvGetTextForTagType(OKVDEF_ITEM_TYPE_INT));

15.30 okvGetTextLenForAttributeNum

okvGetTextLenForAttributeNum returns the length of the name of the attribute for a given Oracle Key Vault attribute number.

Category

KMIP Utility API

Purpose

okvGetTextLenForAttributeNum returns the length of the name of the attribute for a given Oracle Key Vault attribute number.

Syntax

ub4 okvGetTextLenForAttributeNum(OKVAttrNo attrno);

Parameters

Parameter IN/OUT Description
attrno

IN

Oracle Key Vault attribute number of the KMIP attribute.

Return Values

Return Value Description
ub4

Length of the attribute name.

Success: Length of the buffer is returned.

Failure: 0.

Comments

None.

Example

printf("%d", okvGetTextLenForAttributeNum(OKVAttrActivationDate));

15.31 okvObjGetAttrNo

okvObjGetAttrNo will return the Oracle Key Vault attribute number for a given TTLV object.

Category

KMIP Utility API

Purpose

okvObjGetAttrNo will return the Oracle Key Vault attribute number for a given TTLV object.

Syntax

OKVAttrNo okvObjGetAttrNo(OKVEnv *env, OKVTTLV *ttlv);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

ttlv IN OKVTTLV object.

Return Values

Return Value Description
OKVAttrNo

Oracle Key Vault attribute number for the TTLV object.

Success: Oracle Key Vault attribute number for the given TTLV object is returned.

Failure: OKVAttrInvalid is returned.

Comments

None.

Example

OKVTTLV *ttlv = (OKVTTLV *) NULL;
...
switch (okvObjGetAttrNo(env, ttlv))
{
   ...
   case OKVAttrObjType:
      ...
   case OKVAttrCryptoAlg:
      ...
   case OKVAttrCryptoLen:
      ...
   case OKVAttrCryptoUsageMask:
      ...
}

15.32 okvCryptoContextSetCryptoAlgo

okvCryptoContextSetCryptoAlgo sets the cryptographic algorithm parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetCryptoAlgo sets the cryptographic algorithm parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetCryptoAlgo(OKVEnv *env,
                                       OKVCryptoContext *crypto_context,
                                       ub4 crypto_algo);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context IN

Cryptographic context contains required parameters for cryptographic operations.

crypto_algo IN

Cryptographic algorithm.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env,OKVOpSign);
okvCryptoContextSetCryptoAlgo(env, crypto_context, CRYPTO_ALG_RSA);

15.33 okvCryptoContextSetHashingAlgo

okvCryptoContextSetHashingAlgo sets the hashing algorithm parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetHashingAlgo sets the hashing algorithm parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetHashingAlgo(OKVEnv *env,
                                        OKVCryptoContext *crypto_context,
                                        ub4 hashing_algo);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
crypto_context IN Cryptographic context contains required parameters for cryptographic operations.
hashing_algo IN Hashing algorithm.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env,OKVOpSign);
okvCryptoContextSetHashingAlgo(env, crypto_context, HASH_ALG_SHA_256);

15.34 okvCryptoContextSetDigitalSignAlgo

okvCryptoContextSetDigitalSignAlgo sets the digital signature algorithm parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextSetDigitalSignAlgo sets the digital signature algorithm parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextSetDigitalSignAlgo(OKVEnv *env,
                                            OKVCryptoContext *crypto_context,
                                            ub4 digital_sign_algo);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
crypto_context IN Cryptographic context contains required parameters for cryptographic operations.
digital_sign_algo IN Digital signature algorithm.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVCryptoContext *crypto_context = okvCryptoContextCreate(env, OKVOpSign);
okvCryptoContextSetDigitalSignAlgo(env, crypto_context, SIGN_ALG_SHA256_W_RSA);

15.35 okvCryptoContextGetCryptoAlgo

okvCryptoContextGetCryptoAlgo gets the cryptographic algorithm parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetCryptoAlgo gets the cryptographic algorithm parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetCryptoAlgo(OKVEnv *env,
                                       OKVCryptoContext *crypto_context,
                                       ub4 *crypto_algo);

Parameters

Parameter IN/OUT Description
env

IN

Oracle Key Vault environment handle.

crypto_context IN Cryptographic context contains required parameters for cryptographic operations.
crypto_algo OUT Cryptographic algorithm.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

ub4 crypto_algo;
okvCryptoContextGetCryptoAlgo(env, crypto_context, &crypto_algo);

15.36 okvCryptoContextGetHashingAlgo

okvCryptoContextGetHashingAlgo gets the hashing algorithm parameter value in the cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetHashingAlgo gets the hashing algorithm parameter value in the cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetHashingAlgo(OKVEnv *env,
                                        OKVCryptoContext *crypto_context,
                                        ub4 *hashing_algo);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
crypto_context IN Cryptographic context contains required parameters for cryptographic operations.
hashing_algo OUT Hashing algorithm.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

ub4 hashing_algo;
okvCryptoContextGetHashingAlgo(env, crypto_context, &hashing_algo);

15.37 okvCryptoContextGetDigitalSignAlgo

okvCryptoContextGetDigitalSignAlgo gets the digital signature algorithm parameter value from cryptographic context structure.

Category

KMIP utility API

Purpose

okvCryptoContextGetDigitalSignAlgo gets the digital signature algorithm parameter value from cryptographic context structure.

Syntax

OKVErrNo okvCryptoContextGetDigitalSignAlgo(OKVEnv *env,
                                            OKVCryptoContext *crypto_context,
                                            ub4 *digital_sign_algo);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
crypto_context IN Cryptographic context contains required parameters for cryptographic operations.
digital_sign_algo OUT Digital signature algorithm

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

ub4 digital_sign_algo;
okvCryptoContextGetDigitalSignAlgo(env, crypto_context, &digital_sign_algo);

15.38 okvCryptoResponseGetSignatureData

okvCryptoResponseGetSignatureData gets the signature data value from the sign response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetSignatureData gets the signature data value from the sign response structure.

Syntax

OKVErrNo okvCryptoResponseGetSignatureData(OKVEnv *env,
                                           OKVSignResponse *sign_response,
                                           ub1 *signature_data,
                                           ub4 *signature_datal);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle
sign_response IN Sign operation response.
signature_data OUT Signature data value.
signature_datal OUT Signature data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

ub1 signature_data[OKV_OBJECT_MAXLEN];
ub4 signature_datal = sizeof(signature_data);
...
/* Perform Sign operation and get sign operation response in 'sign_response' */
...
memset(signature_data, 0, signature_datal);
okvCryptoResponseGetSignatureData(env, sign_response, signature_data, &signature_datal);

15.39 okvCryptoResponseGetRecoveredData

okvCryptoResponseGetRecoveredData gets the recovered data value from the signature verify response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetRecoveredData gets the recovered data value from the signature verify response structure.

Syntax

OKVErrNo okvCryptoResponseGetRecoveredData(OKVEnv *env,
                                           OKVSignVerifyResponse *sign_verify_response,
                                           ub1 *recovered_data,
                                           ub4 *recovered_datal);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle
sign_verify_response IN Signature verify operation response.
recovered_data OUT Recovered data value.
recovered_datal OUT Recovered data value length.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Comments

Returning recovered data is not currently supported by Oracle Key Vault.

15.40 okvCryptoResponseGetValidity

okvCryptoResponseGetValidity gets the validity value from the signature verify response structure.

Category

KMIP utility API

Purpose

okvCryptoResponseGetValidity gets the validity value from the signature verify response structure.

Syntax

OKVErrNo okvCryptoResponseGetValidity(OKVEnv *env,
                                      OKVSignVerifyResponse *sign_verify_response,
                                      ub4 *validity);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
sign_verify_response IN Signature verify operation response.
validity OUT Validity value.

Return Values

Return Value Description
OKVErrNo

Oracle Key Vault error number.

Success: OKV_SUCCESS (0)

Failure: A valid error number is returned for the error on top of the error stack.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

ub4 validity;
...
/* Perform Signature Verify operation and get signature verify operation response in 'sign_verify_response' */
...
okvCryptoResponseGetValidity(env, sign_verify_response, &validity);

15.41 okvSignResponseCreate

okvSignResponseCreate creates the sign response structure to hold the sign operation response details.

Category

KMIP utility API

Purpose

okvSignResponseCreate creates the sign response structure to hold the sign operation response details.

Syntax

OKVSignResponse *okvSignResponseCreate(OKVEnv *env);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.

Return Values

Return Value Description
OKVSignResponse*

Pointer to OKVSignResponse object.

Success: Pointer to OKVSignResponse object.

Failure: NULL pointer.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVSignResponse *sign_response = okvSignResponseCreate(env);

Related Topics

15.42 okvSignResponseFree

okvSignResponseFree frees the memory allocated to the sign response structure.

Category

KMIP utility API

Purpose

okvSignResponseFree frees the memory allocated to the sign response structure.

Syntax

void okvSignResponseFree(OKVEnv *env, OKVSignResponse **sign_response);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
sign_response IN Signature operation response.

Return Values

No value returned.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVSignResponse *sign_response = okvSignResponseCreate(env);
...
okvSignResponseFree(env, &sign_response);

Related Topics

15.43 okvSignVerifyResponseCreate

okvSignVerifyResponseCreate creates the signature verify response structure to hold the signature verify operation response details.

Category

KMIP utility API

Purpose

okvSignVerifyResponseCreate creates the signature verify response structure to hold the signature verify operation response details.

Syntax

OKVSignVerifyResponse *okvSignVerifyResponseCreate(OKVEnv *env);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.

Return Values

Return Value Description
OKVSignVerifyResponse *

Pointer to OKVSignVerifyResponse object.

Success: Pointer to OKVSignVerifyResponse object.

Failure: NULL pointer.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVSignVerifyResponse *sign_verify_response = okvSignVerifyResponseCreate(env);

Related Topics

15.44 okvSignVerifyResponseFree

okvSignVerifyResponseFree frees the memory allocated to the signature verify response structure.

Category

KMIP utility API

Purpose

okvSignVerifyResponseFree frees the memory allocated to the signature verify response structure.

Syntax

void okvSignVerifyResponseFree(OKVEnv *env,
                               OKVSignVerifyResponse **sign_verify_response);

Parameters

Parameter IN/OUT Description
env IN Oracle Key Vault environment handle.
sign_verify_response IN Signature verify operation response.

Return Values

No value returned.

Supported Versions

Oracle Key Vault C SDK release 21.6.0.0.0 and later.

Comments

None.

Example

OKVSignVerifyResponse *sign_verify_response = okvSignVerifyResponseCreate(env);
...
okvSignVerifyResponseFree(env, &sign_verify_response);