Skip to content

Missing initialization of JNI in net6 android app #51274

@touzas

Description

@touzas

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")

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions