Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Creating an executable in Perl6

I am using Moar. It is possible to create perl6 executables now?

I have source codes developed on machineA and I want to run it on machineB which is about 3 times faster than machineA, but I don't want people on machineB to be able to look at the source codes.

Or do I have to change to Java VM?

If it is not possible to create perl6 executables, what is the best way to protect company/department intellectual properties?

like image 714
lisprogtor Avatar asked Jan 06 '19 20:01

lisprogtor


1 Answers

For simple stuff and if you are running it by your own hand on machineB, you may try to decrypt the source within your program or to STDOUT and then feed it to perl6. There are many options for encryption and decryption, for example, one-time pad, gpg or even read things off securely via sockets at machineA. Here is a proof of concept example using zip and unzip,

cat my.p6
for 1 .. 5 { say rand }
zip -e my.zip my.p6
Enter password:
Verify password:
adding: my.p6 (stored 0%)
unzip -p my.zip | perl6
[my.zip] my.p6 password:
0.6868457931159548
0.3818693072902063
0.26339483730150215
0.03617574596367301
0.1992317319783774

As for doing encryption with one-time pad on shell level, a script (requires openssl and ssh) will be used,

./sshencdec.sh -p ~/.ssh/id_rsa.pub < my.p6 > my.p6.enc
./sshencdec.sh -s ~/.ssh/id_rsa  < my.p6.enc | perl6
Enter pass phrase for /home/david/.ssh/id_rsa:
0.4554567534399926
0.5215978159072545
0.5188661477620019
0.4928945548121154
0.2916414959794953
cat my.p6.enc
-- encrypted with https://git.e.tern.al/s2/sshencdec
-- keys
-- key
M32P8T5hAbkozzu9Hsb0UxaHMIowBnm5SGya1JdVRKM85NrsmMaO+JVICdpNCACu
0onf3xIDIdl6IRiLRmbrrG2qOHqYSqHXLLs4Yt7530IvGiDyxpGeygJwt35+PZ4T
KH6FMluenkvkHufsY1xRC2PM8kzQ0xtx9ThVNkupQavVN3SOHaMxVFZUqJCuInFl
Y8e6iMyoF7NfQ4ekUwOtpJtFjB5DzMepxg+iAetTV2E2kwAq5qUTrmkzSTd38b+X
YzdeYmngMjBPzMZ/nrBT4cE2kAYyIGUwTDMa5UsClUUBBAN6Igfxn5O6ozlq9FXk
IIujhfgAn64U2DfcYHCZ2w==
-- /key
-- /keys
U2FsdGVkX18ObEPup0W1+45UewyKoUftMzn+dUDRQp9mDCzJ0/7cVYTe6zNJINIU

So behind the scenes the flow goes like this,

  • encrypt the SECRET to SECRET.enc with a PAD using a strong cipher (the script used AES 256)
  • protect the PAD with asymmetric encryption to produce PAD.enc ( SSH + RSA in this case)
  • Now you will need SECRET.enc, PAD.enc and the private key pass phrase to perform the needful decryption (the script conveniently merge the first two into a single file)

This is useful when you need to share your file (using others public key as long as you can figure out the safe key exchange part)

As for in program operations, AFAIK there isn't any module similar to this in the ecosystems yet, but then you may draw idea from here to build your own helper class/module.

like image 163
hkdtam Avatar answered Oct 23 '22 06:10

hkdtam