An application can create a context for the local VA. This is useful because the context uses the Global VA Service as the default VA. To create the context, your application must perform two tasks:
Set the default VA using the Vtk_CtxtSetDefaultVa function
Add certificate to the context to establish trust with the VA.
Code Sample for Creating Context for Local VA
/* * EvaOCSPCtxt * * Creates a validation context for use with local VA and OCSP. * * Parameters: * evaUrl - url for local VA server for example, * http://labrador.valicert.com:90 * * vaCertFile - VA's certificate file (this could be obtained from * file or other means convenient to the application) */ static Vtk_Ctxt* EvaOCSPCtxt(const char *evaUrl, const char *vaCertFile) { Vtk_Ctxt *ret = NULL; Vtk_Cert *vaCert = NULL; Vtk_uint32 retCode; /* * Create a default Toolkit context. */ ret = Vtk_CtxtNew(); assert(ret != NULL); /* * Customize the context to use OCSP with local EVA. */ if ((retCode = Vtk_CtxtSetDefaultVa(ret, evaUrl, VTK_VM_OCSP)) != VTK_OK) { showError("EvaOCSPCtxt - Vtk_CtxtSetDefaultVa", retCode); exit(-1); } /* * Create a Vtk_Cert structure, and read the certificate from * a file. The certificate can be obtained by any means * convenient to the application. */ vaCert = Vtk_CertNew(ret); assert(vaCert != NULL); if ((retCode = Vtk_CertLoadFromFile(ret, vaCert, vaCertFile, VTK_DF_BASE64)) != VTK_OK) { showError("Vtk_CertLoadFromFile", retCode); Vtk_CertDelete(vaCert); Vtk_CtxtDelete(ret); return NULL; } /* * Add the certificate to the context to establish trust with the * VA */ if ((retCode = Vtk_CtxtAddCert(ret, VTK_VA_CERT, vaCert)) != VTK_OK) { Vtk_CtxtDelete(ret); Vtk_CertDelete(vaCert); showError("EvaOCSPCtxt - Vtk_CtxtAddCert", retCode); return NULL; } /* * VA certificate is no longer needed; delete it. */ Vtk_CertDelete(vaCert); return ret; } /* EvaOCSPCtxt */