Virtru SDK for C++  2.8.0
Virtru C++ SDK library - Create, Read, and Manage TDF3 Files
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
virtru_client_c.h File Reference

Go to the source code of this file.

Functions

DLL_PUBLIC VSTATUS VFreeMemory (void *vMemoryPtr)
 
DLL_PUBLIC VClientPtr VClientCreateWithAppId (const char *owner, const char *appId)
 
DLL_PUBLIC VClientPtr VClientCreateWithHMAC (const char *owner, const char *apiKey, const char *apiSecret)
 
DLL_PUBLIC VClientPtr VClientCreateWithOIDC (const char *owner, const char *organizationName, const char *clientId, const char *clientSecret)
 
DLL_PUBLIC void VClientDestroy (VClientPtr vClientPtr)
 
DLL_PUBLIC VSTATUS VEnableConsoleLogging (VClientPtr vClientPtr, VLogLevel logLevel)
 
DLL_PUBLIC VSTATUS VSetProtocol (VClientPtr vClientPtr, VProtocol vProtocol)
 
DLL_PUBLIC VSTATUS VSetOffline (VClientPtr vClientPtr, bool state)
 
DLL_PUBLIC VSTATUS VClientEncryptFile (VClientPtr vClientPtr, VEncryptFileParamsPtr vEncryptFileParamsPtr, char **outPolicyId)
 
DLL_PUBLIC VSTATUS VClientDecryptFile (VClientPtr vClientPtr, const char *inFilepath, const char *outFilepath)
 
DLL_PUBLIC VSTATUS VClientEncryptString (VClientPtr vClientPtr, VEncryptStringParamsPtr vEncryptStringParamsPtr, char **outPolicyId, VBytesPtr *outBytesPtr, VBytesLength *outBytesLength)
 
DLL_PUBLIC VSTATUS VClientDecryptString (VClientPtr vClientPtr, VCBytesPtr inBytesPtr, VBytesLength inBytesLength, VBytesPtr *outBytesPtr, VBytesLength *outBytesLength)
 
DLL_PUBLIC VSTATUS VClientFetchPolicyForUUID (VClientPtr vClientPtr, const char *policyUUID, VPolicyPtr *vPolicyPtr)
 
DLL_PUBLIC VSTATUS VClientSetKasUrl (VClientPtr vClientPtr, const char *kasUrl)
 
DLL_PUBLIC VSTATUS VClientSetOIDCProviderUrl (VClientPtr vClientPtr, const char *oidcUrl)
 
DLL_PUBLIC VSTATUS VClientSetEasUrl (VClientPtr vClientPtr, const char *easUrl)
 
DLL_PUBLIC VSTATUS VClientSetAcmUrl (VClientPtr vClientPtr, const char *acmUrl)
 
DLL_PUBLIC VSTATUS VClientSetSecureReaderUrl (VClientPtr vClientPtr, const char *srUrl)
 

Function Documentation

DLL_PUBLIC VClientPtr VClientCreateWithAppId ( const char *  owner,
const char *  appId 
)

DEPRECATED in favor of OIDC client credential flows Create a new Virtru client instance with owner and appId.

Parameters
owner- The owner's email address to be used to authenticate for encrypt, decrypt and policy management. Any data encrypted will be owned by the supplied email address. The owner will always have access to the encrypted data (TDF).
appId- The virtru application ID can be obtained from the Virtru Dashboard
Returns
VirtruClient opaque object. NOTE: On failure returns NULL ptr.
DLL_PUBLIC VClientPtr VClientCreateWithHMAC ( const char *  owner,
const char *  apiKey,
const char *  apiSecret 
)

DEPRECATED in favor of OIDC client credential flows Create a new Virtru Client instance with owner and HMAC apiKey/apiSecret. Contact Virtru to get your organization's HMAC apiKey/apiSecret

Parameters
owner- The owner's email address to be used to authenticate for encrypt, decrypt and policy management.
apiKey- The HMAC api key
apiSecret- The HMAC api secret
Returns
VirtruClient opaque object. NOTE: On failure returns NULL ptr.
DLL_PUBLIC VClientPtr VClientCreateWithOIDC ( const char *  owner,
const char *  organizationName,
const char *  clientId,
const char *  clientSecret 
)

Create a new Virtru Client instance with owner and organization/realm-scoped OIDC client credentials. Contact Virtru to get client credentials for clients in your organization

Parameters
owner- The owner's email address to be used to authenticate for encrypt, decrypt
organizationName- The OIDC realm or organization the client belongs to
clientId- The clientId part of the client credentialset issued to the client - The clientSecret part of the client credentialset issued to the client
Returns
VirtruClient opaque object. NOTE: On failure returns NULL ptr.
DLL_PUBLIC VSTATUS VClientDecryptFile ( VClientPtr  vClientPtr,
const char *  inFilepath,
const char *  outFilepath 
)

Decrypt the contents of the TDF file into its original content.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
inFilepath- The TDF file on which the decryption is performed
outFilepath- The file path of the original content after successful decryption
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VClientDecryptString ( VClientPtr  vClientPtr,
VCBytesPtr  inBytesPtr,
VBytesLength  inBytesLength,
VBytesPtr outBytesPtr,
VBytesLength outBytesLength 
)

Decrypt the TDF data

Parameters
vClientPtr- The pointer to Virtru client opaque object.
inBytesPtr- Pointer to buffer containing the TDF data.
inBytesLength- Length of buffer containing the TDF data.
outBytesPtr- On success, it contains the decrypted tdf data.
outBytesLength- On success, it is length of the decrypted tdf data.
Returns
VSTATUS - VSTATUS_SUCCESS on success NOTE: The caller of the api should free outBytesPtr.
DLL_PUBLIC void VClientDestroy ( VClientPtr  vClientPtr)

Destruct the Virtru client instance.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
DLL_PUBLIC VSTATUS VClientEncryptFile ( VClientPtr  vClientPtr,
VEncryptFileParamsPtr  vEncryptFileParamsPtr,
char **  outPolicyId 
)

Encrypt the contents of the input file into a TDF. In the process of encryption, a policy is associated with the TDF. The policy has a unique id which can be used to identify the TDF policy.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
vEncryptFileParamsPtr- Encrypt file param opaque object holding all the required information for encrypt operations
outPolicyId- On success, it contains policy id.
Returns
VSTATUS - VSTATUS_SUCCESS on success NOTE: The caller of the api should free outPolicyId buffer.
DLL_PUBLIC VSTATUS VClientEncryptString ( VClientPtr  vClientPtr,
VEncryptStringParamsPtr  vEncryptStringParamsPtr,
char **  outPolicyId,
VBytesPtr outBytesPtr,
VBytesLength outBytesLength 
)

Encrypt the plain data into a TDF. In the process of encryption, a policy is associated with the TDF. The policy has a unique id which can be used to identify the TDF policy.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
vEncryptStringParamsPtr- Encrypt string param opaque object holding all the required information for encrypt operations
outPolicyId- On success, it contains policy id.
outBytesPtr- On success, it contains the encrypted tdf data.
outBytesLength- On success, it is length of the encrypted tdf data.
Returns
VSTATUS - VSTATUS_SUCCESS on success NOTE: The caller of the api should free outPolicyId buffer and outBytesPtr.
DLL_PUBLIC VSTATUS VClientFetchPolicyForUUID ( VClientPtr  vClientPtr,
const char *  policyUUID,
VPolicyPtr vPolicyPtr 
)

Return the policy associated with the given policy uuid.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
policyUUID- The unique policy uuid.
vPolicyPtr- On success, it hold the ptr to the policy object.
Returns
VSTATUS - VSTATUS_SUCCESS on success NOTE: The caller of the api should free vPolicyPtr.
DLL_PUBLIC VSTATUS VClientSetAcmUrl ( VClientPtr  vClientPtr,
const char *  acmUrl 
)

Set the ACM url that will be used for TDF policy sync operations.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
acmUrl- The base URL for ACM communication.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VClientSetEasUrl ( VClientPtr  vClientPtr,
const char *  easUrl 
)

DEPRECATED OIDC auth flows do not use EAS. Set the EAS url that will be used for tdf3 operations.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
easUrl- The base URL for EAS communication.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VClientSetKasUrl ( VClientPtr  vClientPtr,
const char *  kasUrl 
)

Set the KAS url that will be used for tdf3 operations.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
kasUrl- The base URL for KAS communication.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VClientSetOIDCProviderUrl ( VClientPtr  vClientPtr,
const char *  oidcUrl 
)

Set the OIDC IdP url that will be used to authenticate against.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
oidcUrl- The base URL for the OIDC IdP (e.g. Keycloak) for the client to authenticate against.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VClientSetSecureReaderUrl ( VClientPtr  vClientPtr,
const char *  srUrl 
)

Set the secure reader url which will be used in html tdf.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
srUrl- The URL for Secure reader.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VEnableConsoleLogging ( VClientPtr  vClientPtr,
VLogLevel  logLevel 
)

Enable the internal logger class to write logs to the console for given LogLevel. The default logLevel is 'Warn'

DLL_PUBLIC VSTATUS VFreeMemory ( void *  vMemoryPtr)

Allows for .NET P/Invoke to free native memory

Parameters
vMemoryPtr- The malloc'd memory to be freed.
DLL_PUBLIC VSTATUS VSetOffline ( VClientPtr  vClientPtr,
bool  state 
)

Set the offline mode.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
state- If true, all the TDFs will be encrypted in offline mode that means the symmetric key stored part of the TDF instead on the server.
Returns
VSTATUS - VSTATUS_SUCCESS on success
DLL_PUBLIC VSTATUS VSetProtocol ( VClientPtr  vClientPtr,
VProtocol  vProtocol 
)

Set the TDF protocol (format) to be used for encryption and decryption operations. HTML is the default format. The protocols refer to the data format after encryption. Options are .tdf (which is a zip) or HTML.

Parameters
vClientPtr- The pointer to Virtru client opaque object.
vProtocol- type of the protocol (format)
Returns
VSTATUS - VSTATUS_SUCCESS on success