runtime: Missing initialization of JNI in net6 android app
In a previous version a OpenSSL encryption not rules. In this version: preview-3 encryption produces an error:
[monodroid-assembly] Caching p/invoke entry libSystem.Security.Cryptography.Native.OpenSsl @ AndroidCryptoNative_CipherCreate [monodroid] MonodroidRuntime::monodroid_pinvoke_override ("libSystem.Security.Cryptography.Native.OpenSsl", "AndroidCryptoNative_CipherCreate") [libc] Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 5002 (anyname.Android), pid 5002 (anyname.Android) [monodroid] MonodroidRuntime::monodroid_pinvoke_override ("libSystem.Security.Cryptography.Native.OpenSsl", "AndroidCryptoNative_CipherCreate")
This is my code:
//key is an byte[32] //iv is an byte[16] private static AesCryptoServiceProvider provider = new AesCryptoServiceProvider(); provider.CreateDecryptor(key, iv);
I try copy/paste a code of this page: https://docs.microsoft.com/es-es/dotnet/api/system.security.cryptography.aescryptoserviceprovider?view=net-6.0 When i running this application receive this error:
[monodroid-assembly] Caching p/invoke entry libSystem.Security.Cryptography.Native.OpenSsl @ CryptoNative_GetRandomBytes [monodroid] MonodroidRuntime::monodroid_pinvoke_override ("libSystem.Security.Cryptography.Native.OpenSsl", "CryptoNative_GetRandomBytes") [libc] Fatal signal 11 (SIGSEGV), code 1 (SEGV_MAPERR), fault addr 0x0 in tid 31815 (.AndroidOpenSSL), pid 31815 (.AndroidOpenSSL) [monodroid] MonodroidRuntime::monodroid_pinvoke_override ("libSystem.Security.Cryptography.Native.OpenSsl", "CryptoNative_GetRandomBytes")
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 19 (12 by maintainers)
Commits related to this issue
- Preload System.Security.Cryptography.Native.OpenSsl on startup Work around for https://github.com/dotnet/runtime/issues/51274 which will be removed before NET6 release. — committed to grendello/xamarin-android by grendello 3 years ago
- [java-runtime] Preload net6 OpenSsl on startup (#5913) Context: https://github.com/dotnet/runtime/issues/51274 In .NET 6, `libSystem.Security.Cryptography.Native.OpenSsl.so` needs to be loaded an... — committed to xamarin/xamarin-android by grendello 3 years ago
- [android] remove LoadLibrary workaround Context: https://github.com/dotnet/maui/pull/1046 Context: https://github.com/dotnet/runtime/issues/51274 This partially reverts c4be5240. This code crashes ... — committed to jonathanpeppers/maui by jonathanpeppers 3 years ago
- [android] remove LoadLibrary workaround (#1139) Context: https://github.com/dotnet/maui/pull/1046 Context: https://github.com/dotnet/runtime/issues/51274 This partially reverts c4be5240. This ... — committed to dotnet/maui by jonathanpeppers 3 years ago
- [android] remove LoadLibrary workaround (#1139) Context: https://github.com/dotnet/maui/pull/1046 Context: https://github.com/dotnet/runtime/issues/51274 This partially reverts c4be5240. This ... — committed to lytico/maui by jonathanpeppers 3 years ago
@touzas use .Android instead of .Openssl. We changed the name of the library.