Securing Data
Securing Data
Is there any way we can secure data of an irrlicht application?
I know irrlicht can support zip archives....but can we encrypt and give the password in the app in hardcoded form..?
Any other external free solutions.....?
please help
I know irrlicht can support zip archives....but can we encrypt and give the password in the app in hardcoded form..?
Any other external free solutions.....?
please help
skumar
[quote]You can make it by changing bytes of the file. The logic is like: if encryption key is "3" then incrase every byte by 3 and when you are decrypting it decrase 3.]
Yeah, that is an excellent encryption scheme. :P
There are many threads about this. You can find them with a simple search. The bottom line is that if you are trying to secure the mesh and texture data, you're out of luck. The data has to be sent to the GPU at some point, and that data can be intercepted and read using freely available tools.
Travis
Yeah, that is an excellent encryption scheme. :P
There are many threads about this. You can find them with a simple search. The bottom line is that if you are trying to secure the mesh and texture data, you're out of luck. The data has to be sent to the GPU at some point, and that data can be intercepted and read using freely available tools.
Travis
try searching for encryptors outside irrlicht
type in google:
RSA, DES or simply 'file encryption'/'file encryption c++'
SirSami encryption sure is simple and fast but can be very siply broken.
Personally i would recomend you "shortcut function" (or you can say "hash func")
Try searching and learning a little bit about it it is can be very secure.
Mostly it does something like this:
if you have file:
plepleplepleplepleplepleple (27 bytes)
it merges (add or divide or multiply or whatever i can't remember)
1st and 2nd byte, 3 with 4th, 5th with 6th ect.
so you get something like this:
65dfg1vcb4df6e (14 bytes)
and one more time mearging:
sdfvf5v (7 bytes)
and over...
421v ( 4 bytes)
when you run the program you are just checking if "hash" which have you done before letting it enyone use is similar with hash done by your program every time it starts.
if they are similar, it means that the files are the same files you put in (not any other modified files)
That works because if you modify 1 single bit of your original file the hash returned from hash func. (which can be realy short instead of an file ) will be whole different!
Hope it helps
type in google:
RSA, DES or simply 'file encryption'/'file encryption c++'
SirSami encryption sure is simple and fast but can be very siply broken.
Personally i would recomend you "shortcut function" (or you can say "hash func")
Try searching and learning a little bit about it it is can be very secure.
Mostly it does something like this:
if you have file:
plepleplepleplepleplepleple (27 bytes)
it merges (add or divide or multiply or whatever i can't remember)
1st and 2nd byte, 3 with 4th, 5th with 6th ect.
so you get something like this:
65dfg1vcb4df6e (14 bytes)
and one more time mearging:
sdfvf5v (7 bytes)
and over...
421v ( 4 bytes)
when you run the program you are just checking if "hash" which have you done before letting it enyone use is similar with hash done by your program every time it starts.
if they are similar, it means that the files are the same files you put in (not any other modified files)
That works because if you modify 1 single bit of your original file the hash returned from hash func. (which can be realy short instead of an file ) will be whole different!
Hope it helps
And the darkness begun...
Well there might be point. Its like with locking your house: No matter what lock you will use there, it always can be picked. Its just matter of skill and tools. The point is to make it as hard as to prevent any looser around to breaking in and discourage rest of intruders to the point when they choose to break in to your neighbors house witch is not protected as well as yours.
Or would you say that there isn't much point locking your house?
Or would you say that there isn't much point locking your house?
you can pack all your stuff into your exe by turning the file into a header containing a data array and including that in your project and then reading it from memory. That also speeds up loading times a lot.
for that i use a program called dattoh, no idea if it's something that someone at work made or whether you can download it. there's also bin2h which i believe does the same trick and is something you can download from somewhere.
for that i use a program called dattoh, no idea if it's something that someone at work made or whether you can download it. there's also bin2h which i believe does the same trick and is something you can download from somewhere.
Use IFileSystem::createMemoryReadFile() to create a pseudo-file from the data. Then pass that around to functions that expect an IReadFile*.
Maybe that would help, I use it in my engine:
1. A header file created with bin2h of a mesh.3ds file:
http://nusoftwarege.svn.sourceforge.net ... iew=markup
This file has:
A. BuiltInNUSoftwareIntroMeshData == An array of the file (created with bin2h).
B. BuiltInNUSoftwareIntroMeshDataSize == The size of the array.
2. A code to load it:
Lines 21 to 24 creates an IReadFile object (memoryFile) that you later use to load that mesh (with createMeshFromFile() function).
3. That uses this function (by vitek):
Edit:
I've just remembered that recently a new getMesh() was added that gets an IReadFile object so maybe it would be wiser to use that instead of the custom function (line 26):
1. A header file created with bin2h of a mesh.3ds file:
http://nusoftwarege.svn.sourceforge.net ... iew=markup
This file has:
A. BuiltInNUSoftwareIntroMeshData == An array of the file (created with bin2h).
B. BuiltInNUSoftwareIntroMeshDataSize == The size of the array.
2. A code to load it:
Code: Select all
21 IReadFile* memoryFile = m_pGUIEnv->getFileSystem()->createMemoryReadFile(
22 BuiltInNUSoftwareIntroMeshData,
23 BuiltInNUSoftwareIntroMeshDataSize,
24 "#NUSoftware.3ds");
25
26 IMesh* mesh = createMeshFromFile(SceneManager, memoryFile);
27 memoryFile->drop();
28
29 if(mesh)
30 {
31 m_pSceneNode = SceneManager->addMeshSceneNode(mesh);
32 mesh->drop(); // Ref count should be 3 Before dropping: created, cache and in node
33
34 m_pSceneNode->setID(id);
35 m_pSceneNode->setParent(parent);
36 m_pSceneNode->setPosition(pos);
37 m_pSceneNode->setRotation(rot);
38 m_pSceneNode->setScale(scale);
39 }
3. That uses this function (by vitek):
Code: Select all
345 IAnimatedMesh* createMeshFromFile(ISceneManager* smgr, IReadFile* file)
346 {
347 const c8* fileName = file->getFileName();
348
349 for(u32 n = 0; n < smgr->getMeshLoaderCount(); ++n)
350 {
351 IMeshLoader* loader = smgr->getMeshLoader(n);
352 if(loader && loader->isALoadableFileExtension(fileName))
353 {
354 IAnimatedMesh* mesh = loader->createMesh(file);
355 if(mesh)
356 {
357 // Putting the mesh into the mesh cache...
358 // this would allow a call to smgr->getMesh() to find the mesh
359 IMeshCache* cache = smgr->getMeshCache();
360 if(cache)
361 cache->addMesh(fileName, mesh);
362
363 return mesh;
364 }
365 }
366 }
367
368 return 0;
369 }
I've just remembered that recently a new getMesh() was added that gets an IReadFile object so maybe it would be wiser to use that instead of the custom function (line 26):
And the Irrlicht implementation of it:Irrlicht API wrote:virtual IAnimatedMesh* irr::scene::ISceneManager::getMesh ( io::IReadFile * file ) [pure virtual]
Returns pointer to an animateable mesh. Loads the file if not loaded already.
Works just as getMesh(const char* filename) If you want to remove a loaded mesh from the cache again, use removeMesh().
Parameters:
file,: File handle of the mesh to load.
Returns:
Returns NULL if failed and the pointer to the mesh if successful. This pointer should not be dropped. See IReferenceCounted::drop() for more information.
Code: Select all
//! gets an animateable mesh. loads it if needed. returned pointer must not be dropped.
IAnimatedMesh* CSceneManager::getMesh(io::IReadFile* file)
{
if (!file)
return 0;
core::stringc name = file->getFileName();
IAnimatedMesh* msh = MeshCache->getMeshByFilename(file->getFileName());
if (msh)
return msh;
name.make_lower();
s32 count = MeshLoaderList.size();
for (s32 i=count-1; i>=0; --i)
{
if (MeshLoaderList[i]->isALoadableFileExtension(name.c_str()))
{
// reset file to avoid side effects of previous calls to createMesh
file->seek(0);
msh = MeshLoaderList[i]->createMesh(file);
if (msh)
{
MeshCache->addMesh(file->getFileName(), msh);
msh->drop();
break;
}
}
}
if (!msh)
os::Printer::log("Could not load mesh, file format seems to be unsupported", file->getFileName(), ELL_ERROR);
else
os::Printer::log("Loaded mesh", file->getFileName(), ELL_INFORMATION);
return msh;
}
Irrlicht cache textures so you just have to load all the texture before you load the mesh. This is of course, not very nice since you need to know what textures the mesh use.MasterGod, I really appreciate your sample. What if we have textures in our own "archive" as well?
The best way I can think of is to patch CFileSystem to add your own custom filesystem that has encryption, then recompile Irrlicht.
There was something called SqlLite filesystem patch somewhere in this forum.
My name is bull, for we are many ...