Performing encryption inside a program

I have run into several problems trying to use an account’s public key to encrypt a message within a program.

First, I’m trying to use ecies-ed25519 but the compiler gives me an error and tells me to minimize large stack variables because a function has exceed the max offset of 4096. Is there an alternative crate that allows me to encrypt messages with an account’s public key?

Second, I am aware that Solana’s programs must be deterministic so using rand is out of the question, but I would still like to try encrypting a message using ecies-ed25519::encrypt with a constant number in place of an RNG from rand.

If there is an alternative to encrypting messages within a program, please let me know. Thank you.

:warning: Warning! @SolanaDev is a scammer that will try to steal your crypto. Do not respond to messages from him.

1 Like