Author Topic: Encrypt my DCL file  (Read 626 times)

0 Members and 1 Guest are viewing this topic.

Coder

  • Swamp Rat
  • Posts: 764
Encrypt my DCL file
« on: August 07, 2019, 03:44:06 PM »
Hello guys,

Is there a way to encrypt a DCL file ?
Else I am trying to add the DCL with the lisp file in a VLX but it seems that it does not work because the DCL can't be found !

Any ideas?

Thank you.

PKENEWELL

  • Bull Frog
  • Posts: 219
Re: Encrypt my DCL file
« Reply #1 on: August 07, 2019, 04:22:22 PM »
I don't know of a way to encrypt a DCL file. Also I don't know if the DCL in a VLX file works properly or if there is something special that must be done to make it work.

here are 2 alternative options:

1) have the lisp program write the dcl file on the fly before loading it, then delete the DCL after the program has run (done this way by many in this group). or,

2) Use a 3rd party DCL replacement such as OpenDCL or ObjectDCL.

Hope this helps.
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

ronjonp

  • Needs a day job
  • Posts: 7022
Re: Encrypt my DCL file
« Reply #2 on: August 07, 2019, 04:22:48 PM »
Vovka will probably chime in but yes it can be done. Look at the thread here: http://www.theswamp.org/index.php?topic=47908.0

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

PKENEWELL

  • Bull Frog
  • Posts: 219
Re: Encrypt my DCL file
« Reply #3 on: August 07, 2019, 04:24:51 PM »
Yes - If vovka could chime in, I would be interested i how that is done as well!  :-)
"When you are asked if you can do a job, tell 'em, 'Certainly I can!' Then get busy and find out how to do it." - Theodore Roosevelt

Coder

  • Swamp Rat
  • Posts: 764
Re: Encrypt my DCL file
« Reply #4 on: August 07, 2019, 04:45:09 PM »
Thank you guys for your replies.

I am glad that it is possible and hope that Mr. Vovka would help in this regard.

VovKa

  • Swamp Rat
  • Posts: 1144
  • Ukraine
Re: Encrypt my DCL file
« Reply #5 on: August 07, 2019, 06:09:40 PM »
dcl-s work fine within vlx containers
never had a single problem

i have only one suggestion:
LOAD_DIALOG's argument should not include a full path, only a file name

the latest versions of my program build dcl on the fly
the main reason was - localization
it is easier to build a dcl according to a template than keeping a separate dialog for every language

VovKa

  • Swamp Rat
  • Posts: 1144
  • Ukraine
Re: Encrypt my DCL file
« Reply #6 on: August 07, 2019, 06:13:04 PM »
i have to add:
dcl-s are not encrypted inside vlx-s, they are just plain texts and can be view by any viewer

Coder

  • Swamp Rat
  • Posts: 764
Re: Encrypt my DCL file
« Reply #7 on: August 07, 2019, 06:19:58 PM »
Thank you Vovka, that helps a lot.

MP

  • Seagull
  • Posts: 17399
Re: Encrypt my DCL file
« Reply #8 on: August 07, 2019, 06:25:47 PM »
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore. If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory. EZPZ
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

myloveflyer

  • Newt
  • Posts: 128
Re: Encrypt my DCL file
« Reply #9 on: August 07, 2019, 09:23:17 PM »
Writing and calling dcl on the fly is def the way to go. A simplistic example from days of yore. If security is an issue you can embed encoded strings representing the dcl def (vl-string-translate can be used to create a simple cypher/de-cypher), decoding them before creating the dcl file and then delete the temp dcl file as soon as it's loaded into memory. EZPZ
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?
« Last Edit: August 07, 2019, 09:33:43 PM by myloveflyer »
Never give up !

MP

  • Seagull
  • Posts: 17399
Re: Encrypt my DCL file
« Reply #10 on: August 07, 2019, 09:48:04 PM »
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?

在我之前的帖子中,我提供了一个简单示例的链接:链接。希望有所帮助。
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

myloveflyer

  • Newt
  • Posts: 128
Re: Encrypt my DCL file
« Reply #11 on: August 07, 2019, 10:40:36 PM »
嗨,议员!
如何嵌入表示DCLdef的编码字符串?你能举个例子吗?

在我之前的帖子中,我提供了一个简单示例的链接:链接。希望有所帮助。
Thanks,MP
I will go see how to write, don't know how to ask you again.
Never give up !

MP

  • Seagull
  • Posts: 17399
Re: Encrypt my DCL file
« Reply #12 on: August 07, 2019, 10:57:32 PM »
To illuminate simple encoding maybe this quick example will help.

This is a mild variation of one of the simplest and oldest encoding schemes, rot13.

Read more here: https://en.wikipedia.org/wiki/ROT13

Code: [Select]
(defun ROT45 ( text )
    (vl-string-translate
        "#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~"
        "PQRSTUVWXYZ[]^_abcdefghijklmnopqrstuvwxyz{|}~#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNO"
        text
    )       
)

Example:

    (ROT45 "theswamp.org") >> "E96DH2>A[@C8"

If you run ROT45 on text encoded by ROT45 it returns the original value:

    (ROT45 "E96DH2>A[@C8") >> "theswamp.org"

Or

    (ROT45 (ROT45 "theswamp.org")) >> "theswamp.org"

So let's say this is your naked dcl-def:

Code: [Select]
(setq temp
   '(
        "EdAtt : dialog {"
        "    label = \"Edit Attribute <TagString>\";"
        "    key = \"title\";"
        "    initial_focus = \"text\";"
        "    spacer;"
        "    :   edit_box {"
        "        key = \"text\";"
        "        edit_width = 40;"
        "        edit_limit = 2048;"
        "        allow_accept = true;"
        "    }"
        "    spacer;"
        "    ok_cancel;"
        "    spacer;"
        "}"
    )
)

If we run ROT45 against it (mapcar 'ROT45 temp) we get:

(
    "t5pEE i 5:2=@8 L"
    "    =236= l \"t5:E pEEC:3FE6 k'28&EC:?8m\"j"
    "    <6J l \"E:E=6\"j"
    "    :?:E:2=17@4FD l \"E6IE\"j"
    "    DA246Cj"
    "    i   65:E13@I L"
    "        <6J l \"E6IE\"j"
    "        65:E1H:5E9 l c^j"
    "        65:E1=:>:E l a^cgj"
    "        2==@H12446AE l ECF6j"
    "    N"
    "    DA246Cj"
    "    @<142?46=j"
    "    DA246Cj"
    "N"
)


This encoded string list is what you would place in your source file.

Code: [Select]
(setq dcl-def
   '(
        "t5pEE i 5:2=@8 L"
        "    =236= l \"t5:E pEEC:3FE6 k'28&EC:?8m\"j"
        "    <6J l \"E:E=6\"j"
        "    :?:E:2=17@4FD l \"E6IE\"j"
        "    DA246Cj"
        "    i   65:E13@I L"
        "        <6J l \"E6IE\"j"
        "        65:E1H:5E9 l c^j"
        "        65:E1=:>:E l a^cgj"
        "        2==@H12446AE l ECF6j"
        "    N"
        "    DA246Cj"
        "    @<142?46=j"
        "    DA246Cj"
        "N"
    )
)

When you want to "unpack" it run ROT45 against it (mapcar 'ROT45 dcl-def):

(
    "EdAtt : dialog {"
    "    label = \"Edit Attribute <TagString>\";"
    "    key = \"title\";"
    "    initial_focus = \"text\";"
    "    spacer;"
    "    :   edit_box {"
    "        key = \"text\";"
    "        edit_width = 40;"
    "        edit_limit = 2048;"
    "        allow_accept = true;"
    "    }"
    "    spacer;"
    "    ok_cancel;"
    "    spacer;"
    "}"
)


Notes:
  • While I penned this sample using ROT45 I would not use it in production code, too ez to recognize & break.
  • AutoCAD does not need leading white space in dcl files, it's only there to make it ez for the reader to understand.
  • Forgive any mistakes above, been a long day.

Hope this helps, cheers.
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox

ronjonp

  • Needs a day job
  • Posts: 7022
Re: Encrypt my DCL file
« Reply #13 on: August 07, 2019, 11:55:51 PM »
Glad to see you posting again Michael.  :-) The KungFu is very powerful within you *cheers*.

Windows 10 x64 - AutoCAD /C3D 2020

Custom Build PC

MP

  • Seagull
  • Posts: 17399
Re: Encrypt my DCL file
« Reply #14 on: August 08, 2019, 02:27:24 AM »
Far too kind - thanks man! :)
\|// Set goal. Experiment tirelessly until
|Oo| practice has become expertise.  Loop.
|- | LinkedIn | Dropbox