T O P I C R E V I E W |
couturier |
Posted - 08/20/2020 : 04:21:47 AM Origin Ver. and Service Release (Select Help-->About Origin): 2020b Operating System:win10 64
testLT.h:
#pragma labtalk(0)
double test_dot(double dA, double dB);
double test_add(double dA, double dB);
testLT.c:
#include <Origin.h>
#pragma labtalk(0)
#include "testLT.h"
double test_dot(double dA, double dB)
{
return dA * dB;
}
double test_add(double dA, double dB)
{
return dA + dB;
}
in script window, type:
run.LoadOC("testLT", 16);
test_add(2,3)=;
it returns 5 function shouldn't be callable, right ? |
10 L A T E S T R E P L I E S (Newest First) |
Castiel |
Posted - 08/28/2020 : 09:16:27 AM quote: Originally posted by couturier
quote: I don't think it appropriate to save such information into the source code. Never define the password etc. literally, which can be recovered easily.
My initial thought was to hide the functions with #pragma labtalk(0) and then encrypt the source code. Since #pragma labtalk(0) can't work with header files, I'm gonna encrypt sensitive informations returned by functions + encrypt source code
Don't you think it is enough ?
That depends on the code you write.
Building the OriginC files creates OCB fiels in %LocalAppData%OriginLab\<version>\TMP\OCTemp folder. Open the OCB files with text editor. You can find the literally defined string and a few of the functions called in the code.
------------------------------------------
Be The Change
You Want To See
In The World
------------------------------------------
|
couturier |
Posted - 08/25/2020 : 09:59:45 AM quote: I don't think it appropriate to save such information into the source code. Never define the password etc. literally, which can be recovered easily.
My initial thought was to hide the functions with #pragma labtalk(0) and then encrypt the source code. Since #pragma labtalk(0) can't work with header files, I'm gonna encrypt sensitive informations returned by functions + encrypt source code
Don't you think it is enough ? |
Castiel |
Posted - 08/25/2020 : 07:12:31 AM quote: Originally posted by couturier
OK
I have functions that will returns sensitive stuff, such as id and password for accessing databases.
Any trick to hide those functions ?
I don't think it appropriate to save such information into the source code. Never define the password etc. literally, which can be recovered easily.
------------------------------------------
Be The Change
You Want To See
In The World
------------------------------------------
|
couturier |
Posted - 08/21/2020 : 12:20:07 PM Great !
Thanx Chris |
Chris D |
Posted - 08/21/2020 : 12:07:37 PM Hi Antoine,
We have a built in OC function (undocumented) to encrypt and decrypt.
BOOL TranscribeText(LPCSTR lpcszText, string* pstrOut, BOOL bForward = TRUE, LPCSTR lpcszPassword = NULL);
Example:
void crypt_test()
{
string str_begin = "My secret text to encrypt";
string str_encrypted;
string str_password ="hidden";
string str_decrypted;
// Encrypt using password.
TranscribeText(str_begin, &str_encrypted, TRUE, str_password);
// Decrypt using password.
TranscribeText(str_encrypted, &str_decrypted, FALSE, str_password);
}
Thanks, Chris Drozdowski Originlab Technical Support
|
couturier |
Posted - 08/21/2020 : 10:32:35 AM the thing is that even if source code is encrypted, the functions will still return values.
so user can type "list f" in script window and get all the functions, then spot some, call them from script window and retrieve sensitive stuff.
For example, I have loads of functions that will get/set data from a database. Inside those functions, instead of hardcoding the access (in case of any change), I have: func_path() that will return access path func_key() that will return password to access the database
|
lkb0221 |
Posted - 08/21/2020 : 10:09:36 AM You can put those sensitive process into an ocz file (password protected OriginC source code file), so that end user won't be able to debug and see the value. |
couturier |
Posted - 08/21/2020 : 09:46:06 AM OK
I have functions that will returns sensitive stuff, such as id and password for accessing databases.
Any trick to hide those functions ? |
cpyang |
Posted - 08/20/2020 : 12:55:18 PM Yes, Chris is right,
#pragma labtalk must proceed functions, and #include will break it.
CP
|
Chris D |
Posted - 08/20/2020 : 10:38:23 AM It seems that the inclusion of the header file causes a problem. I'll JIRA and when the devs get back to me, I'll report (if they don't report to you first).
Thanks, Chris Drozdowski Originlab Technical Support
|