Encrypt/decrypt jit model in c++

I have a model I trained in pytorch. I have exported it using torch.jit.trace() and have a model.pt file. In c++ (libtorch) I am able to load and predict using this mode.l I want to be able to encrypt the model.pt file. Decrypt it in memory, make predictions. How can I do this. Not sure how to load a jit trace model from memory or how to encrypt it.

Last I looked, you could use std::stringstream to load from memory. Or you could look for an encryption library that provides an iostream interface.

Best regards

Thomas

Doing this is useless because dumping a programs memory takes 5 seconds. If you don’t want people to have the model then don’t put it on their computer