There has been much talk about cloud technology over the past few years. Cloud storage is something that has become much more common in recent years. Customers now have easy access to cloud storage and sometimes do not even know they are using it directly and what permissions they are giving to their files. A simple mistake on their part could expose their files and other data to the public.
In the context of a 3ds Max plugin, this may not seem to be very important, but the reality is that any data that you store into a user’s 3ds Max file, may suddenly become exposed to the entire planet through a simple and thoughtless file copy.
For this reason, I encourage you to consider data encryption of all your customer’s sensitive data. A common place to store data for a plugin would be within the parameter block structure. In this post I will introduce the idea of using a parameter block accessor to specialize the handling of data. This lends itself to very well to data encryption. You can use the parameter block accessor class to do the custom encryption work before storing the data, and then decrypt it before displaying the data back to the user.
First, let’s build a simple plugin that has some parameter block storage present. I used the 3ds Max SDK Wizard to create a Material plugin, and then added a string parameter to the parameter block definition that the Wizard created. Here is the new string parameter definition for the parameter block, and the reference to the custom accessor:
mtl_mat1_stringval, _T("mtl_mat1_stringval"), TYPE_STRING,
p_ui, TYPE_EDITBOX, IDC_MTL1_STRVAL,
The added control is an edit box that allows the user to type in some string data. Notice that we asked the parameter block to use our specialized accessor class instead of the default system. This allows us to intercept the string and encrypt/decrypt it as we want within the set/get operations. You mainly need to implement a class derived from PBAccessor. The implementation allows for the string to be encrypted for storage, but be decrypted for display during runtime. For example, in the debugger, we can see a string after it has been encrypted by our set accessor, right before storing it:
After we have stored it, and need to access it again in the decrypted form for display, we can then decrypt it in the ‘get’ operation:
The example project is here maxProject_2014_04_01.zip