Can i do something like openssl_private_encrypt of php in go

Hi,
I’m trying to migrate my projects from php to go but I found there is no private key encryption method.
As far as I know, go only support private key decryption (rsa.DecryptOAEP).
But php has one called openssl_private_encrypt PHP: openssl_private_encrypt - Manual
Is there any replacement that I can use?
Thanks

1 Like

The PHP: openssl_private_encrypt - Manual is one of the part Cryptography Extensions. Which is official lib cryptography for PHP global used.

In Golang, There is 2 options to get your functions for encrypt-decrypt with openssl private:

  • Options 1: Build your own encrypt-decrypt func. Golang has official packages for cryptography. You can see example of encrypt-decrypt in here.
  • Options 2: Use golang community package. There is a lot lib out there to encrypt-decrypt. For example:
    • https://github.com/VIBHOR94/go-openssl
    • https://github.com/spacemonkeygo/openssl
    • https://github.com/forgoer/openssl
    • https://github.com/Luzifer/go-openssl

Try to comparing each others, and find out that suitable for you.
Hope this could help your questions @orzorc. :blush:

1 Like

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.