I am trying to use [OpenSSL.net][1] in Unity. I've cloned the git repository, build an AnyCPU release built in visual studio which made a directory containing: libeay32.dll, ManagedOpenSsl.dll and ssleay32.dll. I've dragged them in my project in *Assets\Plugins\OpenSSL* and I can now access OpenSSL from script:
`using OpenSSL.Crypto;`
I'm using a small script to try and use OpenSSL functionality:
byte[] Encrypt(byte[] bytes)
{
using (CipherContext cc = new CipherContext(Cipher.AES_256_CBC))
{
return cc.Encrypt(bytes, testKey, testIV);
}
}
When I run the method, I get an error in the unity console:
*DllNotFoundException: Assets/Plugins/OpenSSL/libeay32.dll
OpenSSL.Core.Version.get_Library ()
OpenSSL.Core.Native..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpenSSL.Core.Native
OpenSSL.Crypto.Cipher..cctor ()
Rethrow as TypeInitializationException: An exception was thrown by the type initializer for OpenSSL.Crypto.Cipher
TestSerialization.Update () (at Assets/Scripts/SerializedClasses/TestSerialization.cs:51) *
On line 51, the encrypt method is called. I'm targeting Android and in a later stage IOS but it seems to not even work on Windows 10.
Can someone tell me how this happens?
Kind regards,
Yorick
[1]: https://github.com/openssl-net/openssl-net
↧