EP_CryptEncryptBuffer

Post here any topics that related to Enigma Protector, its functionality, your misunderstanding, offers to improvements etc etc etc
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

EP_CryptEncryptBuffer

Post by elore »

Hello.

Sorry, but why don't you have EP_CryptEncryptBuffer function for wide strings? Or did I miss it?

Another question is that the registration data (Name and Key) is stored in the file not encrypted (EP_RegCheckAndSaveKeyW)... It's not really secure... I want to encrypt it using Hardware ID. It means that when this file is copied to another machine it cannot be used if you don't know real registration data.
scorillo7
Posts: 90
Joined: Mon May 11, 2009 11:16 am

Re: EP_CryptEncryptBuffer

Post by scorillo7 »

elore wrote:Hello.
I want to encrypt it using Hardware ID. It means that when this file is copied to another machine it cannot be used if you don't know real registration data.
Hello Elore,
encrypt with hardware ID is not about registration data,even if you know this username/serial for the given ID ,Enigma will not run if the ID on current machine is not the same with hardware id for machine beening encrypted for.
So if the current copy of youre software is not running on the same ID enigma will not decrypt,run the aplication.Simple as that.
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

Re: EP_CryptEncryptBuffer

Post by elore »

Hi. I know this. But I don't want to use Hardware Locked License. I'm using just standard license, but saving them into the file after registration using function "EP_RegCheckAndSaveKeyW". And the problem is that the registration data is stored in the file in unencrypted form.
scorillo7
Posts: 90
Joined: Mon May 11, 2009 11:16 am

Re: EP_CryptEncryptBuffer

Post by scorillo7 »

elore wrote:Hi. I know this. But I don't want to use Hardware Locked License. I'm using just standard license, but saving them into the file after registration using function "EP_RegCheckAndSaveKeyW". And the problem is that the registration data is stored in the file in unencrypted form.
If you're app is not locked by hardware ID(which is wrong if you ask me) the user has these registration info,no? So if that user want to share these Information over the warez sites who can stop this?

YES registration are not crypted!
Enigma
Site Admin
Posts: 3085
Joined: Wed Aug 20, 2008 2:24 pm

Re: EP_CryptEncryptBuffer

Post by Enigma »

elore wrote:Sorry, but why don't you have EP_CryptEncryptBuffer function for wide strings? Or did I miss it?
No, you did not miss it, it just absent. But it is very easy to make, for example, for Delphi it will look like:

Code: Select all

Function EP_CryptEncryptStringW(AStr : WideString) : WideString;
begin
  SetString(Result, PWideChar(AStr), length(AStr));
  EP_CryptEncryptBuffer(PWideChar(Result), PWideChar(Result), length(Result) * sizeof(WideChar));
end;
elore wrote:Another question is that the registration data (Name and Key) is stored in the file not encrypted (EP_RegCheckAndSaveKeyW)... It's not really secure... I want to encrypt it using Hardware ID. It means that when this file is copied to another machine it cannot be used if you don't know real registration data.
No, I disagree. If you do not lock the license to particular PC, then it means that license can be used on any PC, correct? So your users may install your software on any PC and successfully register there. If so, why do you need to hide/encrypt license information, it anyway could be used on any PC?

Another, if you lock license to particular hardware. Then there is no difference is it hidden or no, because the registration key will be working only on particular PC anyway.

But I understand the functionality you are requiring. You just imagined the case, when somebody accessed to users PC with your registered software, just find a key file and get it for own purposes. If the keys file is encrypted, then after copying keys file to another PC will not register the program.
There is some sense in such feature. I will add this into todo list.
But anyway, I'm sure that current registration, with the current "opened" keys is safe enough. If you do not want the license copied to many PCs, you just have to hardware lock it.
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

Re: EP_CryptEncryptBuffer

Post by elore »

Exactly!! You've got the point. Moreover, my software can be distributed as portable. It means that pirates can pack it into zip archive and publish on warez sites with stolen keys in it. In this case a person who dowload it will get it registered automatically having no idea that the software was actually stolen. This thing I want to avoid.

And thanks for the wide encrypt function - I will try.
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

Re: EP_CryptEncryptBuffer

Post by elore »

Hi again.

It looks like I've found a small mistake in "enigma_ide.h"

Code: Select all

LPCTSTR __declspec(dllimport) __stdcall EP_RegHardwareID();
LPCTSTR __declspec(dllimport) __stdcall EP_RegHardwareIDA();
LPCWSTR __declspec(dllimport) __stdcall EP_RegHardwareIDW();
The definition for EP_RegHardwareIDA() seems to be wrong. It shouldnt' return LPCTSTR. I think it should be LPCSTR.

I have unicode project and cannot get ANSI string by this function. :)
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

Re: EP_CryptEncryptBuffer

Post by elore »

Also there is an issue with this code:

Code: Select all

const
  int WM_PUBLIC         = 1;
  int WM_PRIVATE        = 2;

  int MAX_STRING_SIZE   = 255;

  // Ctypt hash types, possible hash values for functions:
  // EP_CryptHashBuffer
  // EP_CryptHashStringA
  // EP_CryptHashStringW
  // EP_CryptHashFileA
  // EP_CryptHashFileW
  int HASH_XOR32        = 0;
  int HASH_MD2          = 1;
  int HASH_MD5          = 2;
  int HASH_RipeMD160    = 3;
  int HASH_SH1          = 4;
  int HASH_SHA224       = 5;
  int HASH_SHA256       = 6;
  int HASH_SHA384       = 7;
  int HASH_SHA512       = 8;
the problem is the the first "const" belongs only to WM_PUBLIC. The rest definitions aren't constants and it caused linker errors like this:

Code: Select all

2> : error LNK2005: "int WM_PRIVATE" (?WM_PRIVATE@@3HA) already defined in License.obj
2> : error LNK2005: "int MAX_STRING_SIZE" (?MAX_STRING_SIZE@@3HA) already defined in License.obj
2> : error LNK2005: "int HASH_XOR32" (?HASH_XOR32@@3HA) already defined in License.obj
2> : error LNK2005: "int HASH_MD2" (?HASH_MD2@@3HA) already defined in License.obj
2> : error LNK2005: "int HASH_MD5" (?HASH_MD5@@3HA) already defined in License.obj
and so on.
Enigma
Site Admin
Posts: 3085
Joined: Wed Aug 20, 2008 2:24 pm

Re: EP_CryptEncryptBuffer

Post by Enigma »

elore

Regarding your issue with hiding of license information. There is no any problem if you make this yourself. It is very if you do not use standard registration dialog and option "Execute only if registered". If you are checking registration yourself, then you may just use only EP_RegCheckKey, and manually load/save registration information into file. Also, you may manually encrypt/decrypt this file with a hardware ID. For example, at file start you will load registration information from external file, decrypt it with hardware id, and then you will call EP_RegCheckKey to verify it.

Hope you've understood this idea.
elore wrote:The definition for EP_RegHardwareIDA() seems to be wrong. It shouldnt' return LPCTSTR. I think it should be LPCSTR.
Hm... Ok, I will check this out!
elore wrote:the problem is the the first "const" belongs only to WM_PUBLIC. The rest definitions aren't constants and it caused linker errors like this:
Also thanks for the information. Just curious why, when I compile examples with the current definitions all is well....?
elore
Posts: 25
Joined: Sat Oct 23, 2010 4:27 pm

Re: EP_CryptEncryptBuffer

Post by elore »

you may just use only EP_RegCheckKey, and manually load/save registration information into file. Also, you may manually encrypt/decrypt this file with a hardware ID.
Yep, thanks. I think I will do it in this way. And to do that I need correct version of EP_RegHardwareIDA(), which is not working for me now. :)
Also thanks for the information. Just curious why, when I compile examples with the current definitions all is well....?
It happens if you include "enigma_ide.h" more than once in the project. In examples you include it only one time.
Post Reply