Securing Models
Model Encryption
Valuable models can be protected with a password. When the password string, kept
by KerneCAD component, is not empty, during any save operation the
model is srongly encrypted using the password. The same password is expected to
be set for the model to be able to load. If the password is not set or wrong the
model file being loaded will be invalid and the load operation will fail. This
way it is possible to ensure that the model can be viewed only by specific
user(s)
The password is not stored in the model. It can only be set at run time. The
password is the string with id 1 from the
component context.
For example, to set "orange" as the password for reading and/or writing obtain IKCContext
interface via Component >
GetView > IView
> IKCContext and use IKCContext.SetStringParam(1,
"orange"). Call IKCContext.GetStringParam(1) the
check if the passworf has already been set. Call IKCContext.SetStringParam(1,
"") to make the password empty and to stop using encryption.
If the application has to load a secured model on the start, the
ModelPath should be empty in the DG Kernel
control properties. On start the application must set password first and then
load the required model either by setting
ModelPath or using other methods described in
Model Persistance.
When a password is set DG Kernel still detects at runtime and loads unencrypted
models in usual non-secure mode. Contact us to
request ability to customise this behaiviour.
Persistence to memory
For security and performance reasons the model can also be saved to or loaded
from a memory buffer thus avoiding saving to to the disk altogether. See
IModelEx.LoadFromMemory() and
IModelEx.SaveToMemory().
Embedded models
The model can also be embedded in the executable file of the application. In
addition to extra security this makes sure that the application always uses the
correct model and sometimes more convenient way to deploy the application. See
EmbeddedModel property
for details.
Default model file extension
It is possible to change the default .mdg model file extension. Files with the
default extension are assumed to have the default DG Kernel format,
normally saved as .mdg. The default extension is the string with id 2 from the
component context. For example,
to change the default extension from .mdg to .mmod use IKCContext.SetStringParam(2,
"mmod"). Call IKCContext.GetStringParam(2) to
obtain the current default extension.
|