Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
1
Question by Cambesa · Dec 21, 2017 at 01:08 PM · dllsecuritydllnotfoundexceptionencryptionencrypt

OpenSSL-net DllNotFoundException: Assets/Plugins/OpenSSL/libeay32.dll

I am trying to use OpenSSL.net 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

Comment
Add comment
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

Answer by Cambesa · Dec 22, 2017 at 02:49 PM

Solved by switching to this OpenSSL.net repository which is a wrapper written in C# targeting the .NET Framework 3.5.

When you clone the repository(using SourceTree or Tortoise Git or any program of your choice), you will find a folder called native containing Windows dll builds for 32bit and 64bit. Drop the 32bit libeay32.dll and ssleay32.dll in the unity folder: \Assets\Plugins\x86 and drop the 64bit libeay32.dll and ssleay32.dll in \Assets\Plugins\x86_64.

When that's done open the ManagedOpenSsl-VS2015.sln in Visual Studio (2017). Build the project and navigate to the bin folder which is in the same folder as the .sln. Go in the Debug folder and copy the ManagedOpenSsl.dll and drop it in \Assets\Plugins. You should now be able to access OpenSSL by writing any of these usings:
using OpenSSL;
using OpenSSL.Core;
using OpenSSL.Crypto;
using OpenSSL.Exceptions;
using OpenSSL.Extensions;
using OpenSSL.SSL;
using OpenSSL.X509;
using OpenSSL.Crypto.EC;

Kind regards,

Yorick

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image
1

Answer by remy_rm · Feb 27, 2018 at 10:08 AM

if you still get an error saying DllNotFoundException: libeay32 Then you might have to install openSSL from https://slproweb.com/products/Win32OpenSSL.html

I also had to add OpenSSL to my paths > Enviroment variables ( ";C:\OpenSSL-Win64\bin")

Comment
Add comment · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users

Your answer

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

73 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Every time I re-open Unity, I have to rebuild one of my external DLLs -1 Answers

Failed to load dll error 3 Answers

MIdiJack DLL not found 0 Answers

Publishing Question - Is it possible to make the data folder and assets not modifiable by the game user? 1 Answer

use [DllImport("xxxx")] for .so with other .so 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges