EddTally

EddTally

Elixir Version of Javas Encrypted Class Files? -> Securing Elixir Code

I have a Java class which is stored as an encrypted class for important security reasons then only decrypted at application startup, this is completed by various Java tools, I would like the same to happen to my Elixir Module.
Is there a similar/recommended thing in Elixir/Erlang?

First Post!

cmo

cmo

So you write a module, encrypt and save to disk/db, application reads it and loads module? Where does the encryption key live?

Most Liked

hauleth

hauleth

If the module is unencrypted in memory, then they can dump all of that. If you encrypted the module, then you also have key for that encryption stored anywhere in the memory or in a file that is readable by current application.

In short, it doesn’t really make sense to me to encrypt the BEAM files.

harmon25

harmon25

You must secure the keys. Not the methods.

A motivated attacker can likely guess or infer the method based on structure of the encrypted blob.

hauleth

hauleth

Just use method properly, then even if there will be a breach, as long as the key do not leak, you will be safe. There is little to no point of keeping encryption method secret. It can help with slowing down attack, but itself it does nothing. As long as your protocol do not have flaws and keys are secure then forcing yourself with hiding encryption method is pointless. See at the TLS where encryption method is actually public.

Last Post!

f0rest8

f0rest8

I’d like to second what @hauleth said.

You should be able to reveal how you encrypt data (minus the key) and that data should still remain effectively safe. That is the overall meaning or expectation behind strong/good encryption (I’m “colloquializing” but for simplicity’s sake).

You don’t want to have an encryption method that’s strength is due to the obfuscation of the method. That would render it effectively weak or not good encryption and would provide a false sense of security for you and the people depending on the encryption.

I’m not sure for your particular use-case what strategy you may want to take, but the enacl library mentioned in my other post is an elixir library that enables you to work with the world class NaCl/libsodium libraries.

So, storing keys separately is typically how it’s done. There are even key management services you can use that are more sophisticated ways of, again, storing keys separately so that if your encrypted data is obtained, it’s not necessarily obtained with the keys to decrypt it.

Cloak is another elixir library that is geared more toward what it sounds like you’re trying to do: encrypted at rest in the db (cloak_ecto too if dealing specifically with ecto).

Where Next?

Popular in Questions Top

hariharasudhan94
I would like to know what is the best IDE for elixir development?
New
skosch
To my knowledge, put_in, Map.update etc. all have the one limitation of not automatically creating intermediate keys when needed (for exa...
New
PeterCarter
There are pre-rolled solutions for other frameworks that do work. However, Phoenix does not seem to have these. Have people had good expe...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
sen
Hi All, I set a environment variables in dev.exs , like below code. when i start server, how can i set the ${enable} value? thanks. d...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

jononomo
I am trying to figure out how Mix knows whether the environment is test, dev, or prod – where is this set? Thanks.
New
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
axelson
This post is a wiki (feel free to hit the edit button near the bottom right of this post to add your own changes!) This post collects co...
239 49134 226
New

We're in Beta

About us Mission Statement