Bo Olsen
Jul 12, 2018
7:25 am

Development Legacy Knox Key - 102 Unknown Error

Hello.

I have a similar problem to this https://seap.samsung.com/forum-topic/elm-activation-errorunknown

I cannot activate Knox Legacy License on two of my devices. When trying it returns 102 (unknown error).

This started recently without changing the code, and I have tried downloading the "KnoxSdkSample" just in case, same outcome.

I have 5 devices, one of the devices that doesn't work, is a Sgs7:

SM-G930F
R58H908KRCR
Android 8.0
Knox version 3.1
Knox API level 25

Devices that doesn't work is android version 8 (this is propably a coincidence), the other devices is below

I have tried logging into "Web Account" https://www2.samsungknox.com/en/user
To remove the devices from the license, using the "Deactivate devices" tool

This tool told me the license length was not correct. (assuming because it isn't built for Legacy licenses)
For some reason I can't seem to find the "Generate License Key" for Knox Legacy Keys anymore (https://seap.samsung.com/license-keys).

 

How can I get my current Legacy License key to work again?

Best Regards Bjarke

Similar topics

No similar topics found.
Bo Olsen
Jul 13, 2018
6:55 am

Hello Jenna,

Thanks for the quick response

1) Yes, three devices gets activated successfully, two doesn't (with the same code)
the two devices used to work, and we haven't changed anything "license activation" related in the code since then

2) I'm using a development license while in debug mode (which is when i experience the error)
our production enviroment works great using the same code (except here we are using a development license)

3) I've sent the dumpstate to jennatest862@gmail.com

Best regards,
Bjarke

Jenna S.Samsung SEAP Moderator
Jul 13, 2018
9:28 pm

Hello Bjarke,

To clarify, license activation is working on three of your devices and failling on two with the same code? Also are you using a development or production license? Would you be able to take a log of one of the devices that is receiving the error.

Instructions for taking a dumpstate:

1) Reproduce the issue by trying to activate the license.

2) In the Phone Application, enter *#9900#. 
3)"Run dumpstate/logcat". 
4) Select "Copy to sdcard". 
5) Navigate to the "log" directory that was created on the device using the "My Files" app or a Windows PC with USB cable connection. 
6)  Send the file to jennatest862@gmail.com.

Best regards,

Jenna

 

 

Jenna S.Samsung SEAP Moderator
Jul 13, 2018
9:30 pm

Hi Bjarke,

I looked through your log. The easiest fix is to generate one of the new SKL keys. This can be done here.

Best regards,

Jenna

Bo Olsen
Jul 14, 2018
3:41 pm

Hi Jenna,
Once again, thanks for your reply.

I'll try generating a new license when I get back at the office, though it'll be a while.
What exactly is the problem? And what would a "harder" fix involve? Asking because I'm curious.

Best regards,

Bjarke

Bo Olsen
Aug 06, 2018
12:38 pm

Hi Jenna,
I Couldn't create a new SKL key as it told me that I already had created it previously created them (Jun 8, 2018), and I didn't know how to remove them.
These keys haven't been used before, to my knowledge, so i went ahead and tried 2 of the keys
Samsung Knox License (SKL) key (Development)
and
Samsung Knox License (SKL) key (Development)  (the one in the legacy knox standard tab)

both of them returned "Invalid License".

further more they don't have the same structure as the old key which looked like this ******************************************************************************************************************************** (128 char).

Skl key looks like this *****-*****-*****-*****-*****-*****
Am I using the correct keys?

Best Regards,
Bjarke

Jenna S.Samsung SEAP Moderator
Sep 06, 2018
9:42 pm

Hi Bjarke,

That key should work fine. Make sure that you are using the KnoxEnterpriseLicense Manager and not the EnterpriseLicenseManager. If it is still not working let me know and see if you can get the exact error code.

Best regards,

Jenna

Bo Olsen
Sep 14, 2018
11:06 am

Thanks Jenna. It works perfectly on the newest device.

I have two older devices ("Galaxy s4"(Android 5.0.1, enterprise_sdk:version_5_3) and "sm-t111" (Android 4.2.2, enterprise_sdk_4_0_1)) that doesn't fully work;

Let me clarify:
The two devices gets enrolled (which means the license receiver works), 
but when I use the api to, for example install an apk,
I receive  an error that tells me that I need the permission "android.permission.sec.MDM_APP_MGMT"
The permission is in the manifest.

This is not a problem on the newest device "SM-G930f", android 8.0, knox 3.1

I have used a "Samsung Knox License (SKL) key (Development)" - the one found below Legacy SDK on https://seap.samsung.com/license-keys

Comments

Hi Bjarke, 

For devices older than knox 2.7, you need to activate a backwards compatability key. You will need to activate this key with the EnterpriseLicenseManager. Also include the supportlib.jar if you are not already.

Best regards,

Jenna

Jenna S.Sep 14, 2018 at 5:10 pm
Bo Olsen
Sep 17, 2018
7:19 am

Hi Jenna

I have the edm.jar included if that is what you mean by supportlibrary.jar

I already am using the EnterpriseLicenseManager. Maybe you can spot something in my receiver and activation class? (It's C# code):

The license receiver gets the intent and activates the license, but it says I'm missing permissions when using the api's

___

[IntentFilter(new[] { "edm.intent.action.knox_license.status" })]

    [IntentFilter(new[] { "edm.intent.action.license.status" })]

    public class AgentKnoxLicenseReceiver : BroadcastReceiver

    {

private const string KnoxDevelopmentLicenseKey = "<The development key>" //The skl key is actually here

(...)

if (intent?.Action == KnoxEnterpriseLicenseManager.ActionLicenseStatus) // SKL Keys

            {

                var resultCode = intent.GetIntExtra(KnoxEnterpriseLicenseManager.ExtraLicenseErrorCode, -888);

                var resultString = intent.GetStringExtra(KnoxEnterpriseLicenseManager.ExtraLicenseStatus);

 

                if (resultCode == KnoxEnterpriseLicenseManager.ErrorNone) // success

                {

                    log.Info($"Samsung Knox License Accepted with result: {resultString}");

                    InitializeKnox(context);

                }

                else // failed

                {

                    // https://seap.samsung.com/api-references/android-standard/reference/andro...

                    switch (resultCode)

                    {

                        case KnoxEnterpriseLicenseManager.ErrorLicenseTerminated:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode}) LicenseTerminated");

                            break;

                        case KnoxEnterpriseLicenseManager.ErrorInvalidLicense:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode}) InvalidLicense");

                            break;

                        default:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode})");

                            break;

                    }

                    var thisappname = context.ApplicationInfo.LoadLabel(context.PackageManager);

                    log.Debug($"app name: '{thisappname}'");

                }

 

                var vm = _enrollViewModelWaiting;

                _enrollViewModelWaiting = null;

                if (vm != null)

                {

                    MessagingCenter.Send(vm, "MakeDeviceAdminResult", resultCode == KnoxEnterpriseLicenseManager.ErrorNone);

                }

            }

            else if(intent?.Action == EnterpriseLicenseManager.ActionLicenseStatus) // backwards compatible keys

            {

                var resultCode = intent.GetIntExtra(EnterpriseLicenseManager.ExtraLicenseErrorCode, -888);

                var resultString = intent.GetStringExtra(EnterpriseLicenseManager.ExtraLicenseStatus);

 

                if (resultCode == EnterpriseLicenseManager.ErrorNone) // success

                {

                    log.Info($"Backwards Compatible Key - Knox License Accepted with result: {resultString}");

                    InitializeKnox(context);

                }

                else // failed

                {

                    switch (resultCode)

                    {

                        case EnterpriseLicenseManager.ErrorLicenseTerminated:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode}) LicenseTerminated");

                            break;

                        case EnterpriseLicenseManager.ErrorSignatureMismatch:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode}) SignatureMismatch");

                            break;

                        case EnterpriseLicenseManager.ErrorInvalidLicense:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode}) InvalidLicense");

                            break;

                        default:

                            log.Error($"Samsung Knox License Error: {resultString} ({resultCode})");

                            break;

                    }

                    var thisappname = context.ApplicationInfo.LoadLabel(context.PackageManager);

                    log.Debug($"app name: '{thisappname}'");

                }

 

                var vm = _enrollViewModelWaiting;

                _enrollViewModelWaiting = null;

                if (vm != null)

                {

                    MessagingCenter.Send(vm, "MakeDeviceAdminResult", resultCode == EnterpriseLicenseManager.ErrorNone);

                }

            }

(...)

}

______

License activation:

private static EnterpriseLicenseManager _knoxElm;

private static KnoxEnterpriseLicenseManager _knoxSkl;

public static void EnableKnox(Context context, EnrollViewModel enrollViewModelWaiting)

        {

            _enrollViewModelWaiting = enrollViewModelWaiting;

            _knoxSkl = KnoxEnterpriseLicenseManager.GetInstance(context);

(...)

            // Use the Development license instead key in DEBUG builds

            //_knoxElm.ActivateLicense(KnoxDevelopmentLicenseKey);

            _knoxSkl.ActivateLicense(KnoxDevelopmentLicenseKey);

(...)

        }

Bo Olsen
Sep 17, 2018
7:21 am

When I click generate Key below "Other Keys" I see Backwards compatible key
I can see that it only allows key for production. Will I be able to use this key in a development enviroment (does it look at the signing of the apk file) like the other keys.

You want me to activate this key in conjunction with the legacy SKL key?

Jenna S.Samsung SEAP Moderator
Sep 18, 2018
10:48 pm

Hello,

I now realize that you are still using the Legacy Knox Standard SDK. You will need to migrate your app to the Knox SDK, as the legacy SDKs are no longer being supported. You can read more information on how to do this here. As for the backwards compatibility key, you can use this key in a development environment. You will need to activate both the backwards compatibility key and the SKL key in order for the Knox SDK to work on older devices. You can view a sample app here that shows how to use the new SDK and new licenses on an older device. 

Best regards,

Jenna

Bo Olsen
Oct 09, 2018
2:06 pm

Hi Jenna,
I've replaced the 2 jar files with knoxsdk.jar and supportlib.jar
and followed the migration guide.

in my on receive method i have this line of code:
else if (intent.Action.Equals(KnoxEnterpriseLicenseManager.ActionLicenseStatus))

and I have these intent filters in my broadcast receiver:

[IntentFilter(new[] { "com.samsung.android.knox.intent.action.LICENSE_STATUS" })]
[IntentFilter(new[] { "edm.intent.action.knox_license.status" })]
[IntentFilter(new[] { "edm.intent.action.license.status" })]

my IDE tells me that
KnoxEnterpriseLicenseManager.ActionLicenseStatus = "com.samsung.android.knox.intent.action.LICENSE_STATUS"
which is correct according the the migration guide and
new const val
https://seap.samsung.com/api-references/android/reference/com/samsung/an...

Old const val:
https://seap.samsung.com/api-references/android-standard/reference/andro...
,but for some reason when i attempt activating the license, it is the old "edm.intent.action.knox_license.status" intent that the receiver gets.
I have attempted to add this in the if sentence above, which resulted in Error code "0xfffffc88"

 

What am I missing?

ps I am using the SKL key, same that worked before, this key has been renamed to KPE. in the samsung key portal https://seap.samsung.com/license-keys

 

Comments

Hi Jenna.
Thanks for your patience

I added
[IntentFilter(new[] { "com.samsung.android.knox.intent.action.KNOX_LICENSE_STATUS" })]
and was able to Activate the license

I removed the other intent filters
[IntentFilter(new[] { "edm.intent.action.knox_license.status"
[IntentFilter(new[] { "edm.intent.action.license.status" })]

, as I assume they are deprecated.
I still don't understand why they were broadcasted in the first place.

Bo OlsenOct 10, 2018 at 8:55 am
Jenna S.Samsung SEAP Moderator
Oct 11, 2018
12:19 am

Hello Bo,

I will look into why these intents were broadcasted, but I am happy you were able to get it working.

Best regards,

Jenna