Secure way to 'sign' programs?
#1
Posted 28 November 2015 - 09:22 PM
#2
Posted 28 November 2015 - 09:32 PM
Anything you do to your program, I (or any halfways decent programmer) could undo. The only thing I can think of is requiring a password upon installation, which is provided in the forum post. But then again, they could easily steal the password as well. You could add comments to your code indicating it's yours... but it'd be simple to remove them before redistributing it.
#3
Posted 29 November 2015 - 12:53 AM
KingofGamesYami, on 28 November 2015 - 09:32 PM, said:
Anything you do to your program, I (or any halfways decent programmer) could undo. The only thing I can think of is requiring a password upon installation, which is provided in the forum post. But then again, they could easily steal the password as well. You could add comments to your code indicating it's yours... but it'd be simple to remove them before redistributing it.
#4
Posted 29 November 2015 - 12:58 AM
KingofGamesYami, on 28 November 2015 - 09:32 PM, said:
Anything you do to your program, I (or any halfways decent programmer) could undo. The only thing I can think of is requiring a password upon installation, which is provided in the forum post. But then again, they could easily steal the password as well. You could add comments to your code indicating it's yours... but it'd be simple to remove them before redistributing it.
I don't think he's asking whether or not it's possible to prevent the program itself from being stolen, but rather he wants to be able to sign addons in such a way that one can verify the integrity of the addon, but not get a hold of the certificate. I'm no expert in cryptography by a long shot, but I believe what you're looking for is asymmetric encryption. The author would have a private key and a public key, and to demonstrate their authenticity would sign a message and send it to the user, who would then decrypt the message with the public key. If the message is unchanged, then the author is probably who they say they are. If anyone really knows their stuff on this subject, feel free to correct me as I've done minimal research.
Edit: @Quartz Looks like you're thinking in the same vein as I am, so maybe I'm not crazy
Edited by Yevano, 29 November 2015 - 01:00 AM.
#5
Posted 29 November 2015 - 01:32 AM
Yevano, on 29 November 2015 - 12:58 AM, said:
More or less, yeah. Worth noting that certificates aren't involved in the signing process (they're a different can of worms): you simply set up the OS with the public key, and the addon signer with the private one. If the OS can't decrypt an addon with that public key then it knows it didn't come from a trusted source.
This relies on all addons being installed by your OS, and all addon code being inspected before signing to ensure there's no malicious instructions (inspected by you, the developer of the OS, the only one who has the private signing key and is able to sign stuff). If anyone can run any code on a system without your OS's permission (eg by convincing the user to switch to developer mode), then they can likely take full control of it and remove all future signature checks from the code of your OS.
Obviously such compromisation is pretty trivial to pull off if they have physical access to the system, but that's not your concern.
#6
Posted 29 November 2015 - 02:27 PM
Yevano, on 29 November 2015 - 12:58 AM, said:
KingofGamesYami, on 28 November 2015 - 09:32 PM, said:
Anything you do to your program, I (or any halfways decent programmer) could undo. The only thing I can think of is requiring a password upon installation, which is provided in the forum post. But then again, they could easily steal the password as well. You could add comments to your code indicating it's yours... but it'd be simple to remove them before redistributing it.
I don't think he's asking whether or not it's possible to prevent the program itself from being stolen, but rather he wants to be able to sign addons in such a way that one can verify the integrity of the addon, but not get a hold of the certificate. I'm no expert in cryptography by a long shot, but I believe what you're looking for is asymmetric encryption. The author would have a private key and a public key, and to demonstrate their authenticity would sign a message and send it to the user, who would then decrypt the message with the public key. If the message is unchanged, then the author is probably who they say they are. If anyone really knows their stuff on this subject, feel free to correct me as I've done minimal research.
Edit: @Quartz Looks like you're thinking in the same vein as I am, so maybe I'm not crazy
Yeah, that's what I was looking for. Also, I googled asymmetric encryption, and it says anyone can encrypt w/ the public key, but only the private key can decrypt it. Weird...
Bomb Bloke, on 29 November 2015 - 01:32 AM, said:
Yevano, on 29 November 2015 - 12:58 AM, said:
More or less, yeah. Worth noting that certificates aren't involved in the signing process (they're a different can of worms): you simply set up the OS with the public key, and the addon signer with the private one. If the OS can't decrypt an addon with that public key then it knows it didn't come from a trusted source.
This relies on all addons being installed by your OS, and all addon code being inspected before signing to ensure there's no malicious instructions (inspected by you, the developer of the OS, the only one who has the private signing key and is able to sign stuff). If anyone can run any code on a system without your OS's permission (eg by convincing the user to switch to developer mode), then they can likely take full control of it and remove all future signature checks from the code of your OS.
Obviously such compromisation is pretty trivial to pull off if they have physical access to the system, but that's not your concern.
I will say that addons will likely be sandboxed, and they will NOT run with full system-level access. But yeah, that's the most likely way it'll happen. I'm looking for a lua asymmetric encryption algorithm right now, actually.
Edited by Quartz101, 29 November 2015 - 02:30 PM.
#7
Posted 29 November 2015 - 02:56 PM
Quartz101, on 29 November 2015 - 02:27 PM, said:
You can use either key to encrypt your data but you have to use the opposite key to decrypt. This video explains why you may want to encrypt with either key (or even both types of keys).
Edited by Lupus590, 29 November 2015 - 02:57 PM.
#8
Posted 29 November 2015 - 03:07 PM
The terms "private" and "public" really mean exactly that, and nothing more. You keep one key to yourself, and you allow the other to be made visible to anyone who wants to use it. Whether you reveal the encrypting key or the decrypting key depends on what it is you're trying to do - prove that only you can produce messages the decryption key can decrypt, or ensure that only you can read messages the encryption key encrypted.
#9
Posted 29 November 2015 - 03:46 PM
#10
Posted 29 November 2015 - 05:02 PM
Quartz101, on 29 November 2015 - 03:46 PM, said:
After looking around a little, I might also suggest that you first hash the program you mean to send using SHA2, then encrypt the hash with your private key. Send the encrypted hash and the program to the user. To verify integrity, the user only has to hash the program again, decrypt the encrypted hash, and check that the two hashes are equal.
The first thing I stumbled upon was http://luaforge.net/projects/sha1-rsa/ which seems to include the bigint functions required to do asymmetric encryption. I don't think it has its own key pair generation, so you'll have to use a different program for that, but that's a one time thing anyway so not really a big deal I guess.
Edit: Why not 1lann's? Unless his implementation is just incorrect, (even the one I sent you could be, I have no idea) it seems like his would work fine. You just need to make sure you use a different key pair generator, because as he says in his OP, the one he implemented in Lua is very insecure.
Edited by Yevano, 29 November 2015 - 05:10 PM.
#11
Posted 29 November 2015 - 07:42 PM
Yevano, on 29 November 2015 - 05:02 PM, said:
#12
Posted 29 November 2015 - 07:49 PM
#14
Posted 29 November 2015 - 10:21 PM
1lann's RSA, which is using 256-bits key, is very slow in CC, and not at all secure against cracking on a real computer.
So a good way of doing is using some kind of PHP code do to it for you instead of doing it in CC.
You'd have a separate program to sign the add-ons, and your OS would have code to verify them.
But in the end, your code is still modifiable to the user, and could easily remove that verify portion.
#15
Posted 29 November 2015 - 10:57 PM
Anavrins, on 29 November 2015 - 10:21 PM, said:
1lann's RSA, which is using 256-bits key, is very slow in CC, and not at all secure against cracking on a real computer.
So a good way of doing is using some kind of PHP code do to it for you instead of doing it in CC.
You'd have a separate program to sign the add-ons, and your OS would have code to verify them.
But in the end, your code is still modifiable to the user, and could easily remove that verify portion.
Am I wrong in thinking that only the key pair generation is really slow, not the actual encryption and decryption? It seems he's already going have a server to generate those, and I don't think encrypting and decrypting a SHA2 hash would take very long.
#16
Posted 29 November 2015 - 11:10 PM
#17
Posted 29 November 2015 - 11:34 PM
RoD, on 29 November 2015 - 11:10 PM, said:
Not exactly "signing", but truth be told, I'd say this'd be more than sufficient. Heck, just having a paste (controlled by Quartz) with the list of "authorised addon" paste IDs would be sufficient. The difference is that these ways, if someone were to gain unauthorised access allowing them to modify that list, they'd be able to add their own paste IDs / hashes to it (whereas with encryption implemented, they'd also need to get their hands on the private key in order to do it).
Edit:
What am I thinking, if you wanted any form of "addon authorisation" you'd at least need to post the hashes. Otherwise you could be tricked into "authorising" a good addon which could later be "updated" into a bad one.
But let's assume the point is to sign for the sake of signing.
Edited by Bomb Bloke, 30 November 2015 - 12:53 AM.
#18
Posted 29 November 2015 - 11:57 PM
1. Every developer has a unique key.
2. A server on the web will store the keys
3. The SERVER will handle encrypting/decrypting.
4. The addon itself will be encrypted, and the OS will download the key it needs to decrypt it.
5. Only signed/encrypted addons will be ran unless dev mode is on
6. Anyways, the OS will sandbox everything, so you would need root exploit (or a disk) to remove verification
7. And I might have some sort of intergrity checker in the OS itself.
Honestly, is this signing? I don't know. Checksums would be hard to handle. If there is a more 'sign'-y alternative, tell me.
Also, isn't CC really glitchy with HTTPS?
#19
Posted 30 November 2015 - 12:27 AM
Though I have a strong interest in cryptography, I'm in no way an expert at it, so it is up to you to decide if you trust me or not.
Edited by Anavrins, 30 November 2015 - 02:08 AM.
#20
Posted 30 November 2015 - 12:56 AM
You also wouldn't bother encrypting entire addons when just a hash would suffice.
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











