openssl this way can only encrypt small files:
openssl rsautl -encrypt -pubin -inkey public_key.pem -in secret.txt -out secret.enc
openssl as I found suggested here throws an error:
openssl smime -encrypt -aes-256-cbc -binary -in secret.txt -outform DER -out secret.txt.der public_key.pem
not that you're supposed to be using smime because that's for mail but still see the Error:
unable to load certificate 140222726453056:error:0909006C:PEM routines:get_name:no start line:crypto/pem/pem_lib.c:745:Expecting: TRUSTED CERTIFICATE
Why is openssl complaining about a trust certificate? That's my business. I know it means that it wants the PEM to be of a different format rather than taking it personally.
What do I want?
I want to use bash to encrypt any file with strong encryption using a public PEM file (or other public key) so that my project counterpart can use their private key to decrypt it. It would be awesome if I could use powershell native tools as well but that's a big ask and just thought I'd throw it in, in hope of avoiding gitbash for Windows-homed recipients.
I could use gpg but we do not want to introduce generating password generated keys.