euc-releases / wsone-sdk-forms

Workspace One SDK for Xamarin.Forms
Other
3 stars 0 forks source link

Unauthorized App Access. Add app to console and install via Anchor app. Error code:-71 #26

Open danlfarnell opened 1 year ago

danlfarnell commented 1 year ago

Hi,

I'm getting the following exception when running the following code inside the Application class.

 using System.Diagnostics;
using Android.App;
using Android.Content;
using Android.Runtime;
using WorkspaceOne.Android;

namespace Ws1SdkTest.Droid
{
    [Application]
    public class Application : WorkspaceOneApplication
    {
        public Application(IntPtr javaReference, JniHandleOwnership transfer) : base(javaReference, transfer)
        {
            global::Android.Util.Log.Debug(this.GetType().ToString(), "ctor(IntPtr, JniHandleOwnership)");
        }

        public override Intent MainActivityIntent
        {
            get
            {
                return new Intent(AwAppContext, typeof(MainActivity));
            }
        }

        public override void OnCreate()
        {
            try
            {
                System.Diagnostics.Debug.WriteLine($"{this.GetType()} OnCreate()");
                base.OnCreate(this); //<==== *****Error thrown here*****
            }
            catch (Exception e)
            {
                Debug.WriteLine(e.ToString());

                throw;
            }

        }

    }
}
Ws1SdkTest.Droid.Application OnCreate()
[AirWatch_DI] create eager instances ...
[AirWatch_SDKLogRetriever] initializeLogger() called: false
[AirWatch_DefaultLogPipeline] initializeAggregator called
[AirWatch_SDKRollingFileAggregator] Initializing aggregator
[AirWatch_SDKRollingFileAggregator] Aggregator has been initialized
[AirWatch_AWSDKApplicationDelegate] Feature Module is not enabled, skip initializing feature module
[AirWatch_AWSDKApplicationDelegate] Application started
[AirWatch_PreferenceProvider] sdk not initialized returning query null from provider
[AW_Native] Registering natives
[AirWatch_OpenSSLCryptUtil] Create new instance of crypto library
[AirWatchSDK] AppPermissionUtility appKey match
[AirWatchSDK] Agent is installed. Returning Agent as the Binding Package
[AirWatchSDK] AppPermissionUtility appKey match
[AirWatchSDK] Agent is installed. Returning Agent as the Binding Package
[AirWatch_ServiceSecurity] permission check in com.companyname.Ws1SdkTest for package com.companyname.Ws1SdkTest returned: false
[AirWatch] Unauthorized App Access. Add app to console and install via Anchor app. Error code:-71
Java.Lang.RuntimeException: Unauthorized App Access. Add app to console and install via Anchor app. Error code:-71 ---> Com.Airwatch.Crypto.Openssl.OpenSSLLoadException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "file_encrypt_rsa" referenced by "/data/app/~~9-MMR-A46x6W2mGZU8sRMw==/com.companyname.Ws1SdkTest-rB2uAaxq7cV8t3IHlReS5Q==/lib/arm64/libfips_main.so"... ---> Java.Lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "file_encrypt_rsa" referenced by "/data/app/~~9-MMR-A46x6W2mGZU8sRMw==/com.companyname.Ws1SdkTest-rB2uAaxq7cV8t3IHlReS5Q==/lib/arm64/libfips_main.so"...
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
  at Java.Interop.JniEnvironment+InstanceMethods.CallVoidMethod (Java.Interop.JniObjectReference instance, Java.Interop.JniMethodInfo method, Java.Interop.JniArgumentValue* args) [0x00068] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/obj/Release/JniEnvironment.g.cs:11884 
  at Java.Interop.JniPeerMembers+JniInstanceMethods.InvokeAbstractVoidMethod (System.String encodedMember, Java.Interop.IJavaPeerable self, Java.Interop.JniArgumentValue* parameters) [0x0001a] in /Users/runner/work/1/s/xamarin-android/external/Java.Interop/src/Java.Interop/Java.Interop/JniPeerMembers.JniInstanceMethods_Invoke.cs:47 
  at Com.Airwatch.App.AWSDKApplicationDelegate.OnCreate (Android.App.Application application) [0x00031] in <7e7aeef8936043c083a9ad59ce64a629>:0 
  at WorkspaceOne.Android.WorkspaceOneApplication.OnCreate (Android.App.Application p0) [0x00012] in <0aba87adb8fb45c1b5939cb3730d0a47>:0 
  at Ws1SdkTest.Droid.Application.OnCreate () [0x00018] in /Users/danielf3/RiderProjects/Ws1SdkTest/Ws1SdkTest/Ws1SdkTest.Droid/WorkspaceOneApplication.cs:31 
  --- End of managed Java.Lang.RuntimeException stack trace ---
java.lang.RuntimeException: Unauthorized App Access. Add app to console and install via Anchor app. Error code:-71
    at com.airwatch.crypto.provider.AWSecurityProvider.logInfo(Unknown Source:173)
    at com.airwatch.crypto.provider.AWSecurityProvider.<init>(Unknown Source:21)
    at com.airwatch.app.AWSDKApplicationDelegate.initSecurityProvider(Unknown Source:6)
    at com.airwatch.app.AWSDKApplicationDelegate.onCreate(Unknown Source:233)
    at crc64385687a3a1e2c41f.Application.n_onCreate(Native Method)
    at crc64385687a3a1e2c41f.Application.onCreate(Application.java:25)
    at android.app.Instrumentation.callApplicationOnCreate(Instrumentation.java:1229)
    at android.app.ActivityThread.handleBindApplication(ActivityThread.java:7698)
    at android.app.ActivityThread.access$1800(ActivityThread.java:324)
    at android.app.ActivityThread$H.handleMessage(ActivityThread.java:2336)
    at android.os.Handler.dispatchMessage(Handler.java:106)
    at android.os.Looper.loopOnce(Looper.java:226)
    at android.os.Looper.loop(Looper.java:313)
    at android.app.ActivityThread.main(ActivityThread.java:8855)
    at java.lang.reflect.Method.invoke(Native Method)
    at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:571)
    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1135)
Caused by: com.airwatch.crypto.openssl.OpenSSLLoadException: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "file_encrypt_rsa" referenced by "/data/app/~~9-MMR-A46x6W2mGZU8sRMw==/com.companyname.Ws1SdkTest-rB2uAaxq7cV8t3IHlReS5Q==/lib/arm64/libfips_main.so"...
    at com.airwatch.crypto.openssl.OpenSSLCryptUtil.<init>(Unknown Source:76)
    at com.airwatch.crypto.openssl.OpenSSLCryptUtil.createInstance(Unknown Source:61)
    at com.airwatch.crypto.provider.AWSecurityProvider.<init>(Unknown Source:11)
    ... 15 more
Caused by: java.lang.UnsatisfiedLinkError: dlopen failed: cannot locate symbol "file_encrypt_rsa" referenced by "/data/app/~~9-MMR-A46x6W2mGZU8sRMw==/com.companyname.Ws1SdkTest-rB2uAaxq7cV8t3IHlReS5Q==/lib/arm64/libfips_main.so"...
    at java.lang.Runtime.loadLibrary0(Runtime.java:1077)
    at java.lang.Runtime.loadLibrary0(Runtime.java:998)
    at java.lang.System.loadLibrary(System.java:1661)
    at com.airwatch.crypto.openssl.OpenSSLWrapper.<init>(Unknown Source:40)
    at com.airwatch.crypto.openssl.OpenSSLCryptUtil.<init>(Unknown Source:9)
    ... 17 more

I have added this test app to workspace one and can see it inside the hub application so not sure why i'm getting this error. Any suggestions? Thanks for your help in advance.

danlfarnell commented 1 year ago

Test app can be found @ https://github.com/danlfarnell/Ws1SdkTest.git if you need it. Also please note that I'm running the app on a Galaxy Tab S6 Lite tablet running Android 12.