cancel
Showing results for 
Search instead for 
Did you mean: 

Encryption key for Android SMP application

Former Member
0 Kudos
92

Hi,

I am trying to register a user on SMP through an Android application using this example: http://help.sap.com/saphelp_smp303sdk/helpdata/en/7c/0af4ce70061014beb082150f67fcba/content.htm

When calling ApplicationVariables.userManager.registerUser(false); I get a Null pointer exception with no further details. Before the Null pointer exception the following message appears:

encryption key is null. Terminating execution of pending requests.

I have tried the following to fix the problem:

try {

       if(ApplicationVariables.cypherkey == null) {

            ApplicationVariables.cypherkey = EncryptionKeyManager.getEncryptionKey(getApplicationContext());

        } else {

            EncryptionKeyManager.setEncryptionKey(ApplicationVariables.cypherkey,getApplicationContext());

        }

  } catch (PersistenceException e) {

       e.printStackTrace();

  }

From what I understand the line EncryptionKeyManager.getEncryptionKey(getApplicationContext() is meant to generate the key. When I do this the application goes into that catch and complains once again about the key being null.

How should I be generating the key? Should I be doing this in a custom manner and setting it using the EncryptionKeyManager.setEncryptionKey(ApplicationVariables.cypherkey,getApplicationContext()); ?

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I have partially solved my problem.

It appears that the "encryption key is null. Terminating execution of pending requests." message appears regardless. The null pointer exception (with no further detail) I was getting was caused by performing some of the steps in the wrong order after refactoring and the encryption key message diverged the focus from the actual problem.

There is no longer a crash, but the encryption key message still appears. From the documentation I have read I understand that the encryption will be needed for applications in offline mode which use a Cache.

The crash that occurs when trying the following has still not been solved though:


try {

       if(ApplicationVariables.cypherkey == null) {

            ApplicationVariables.cypherkey = EncryptionKeyManager.getEncryptionKey(getApplicationContext());

        } else {

            EncryptionKeyManager.setEncryptionKey(ApplicationVariables.cypherkey,getApplicationContext());

        }

  } catch (PersistenceException e) {

       e.printStackTrace();

  }

Although It's no longer applicable to my problem as I am, for now, not working with an offline application, an answer may be useful in future or for someone with the same issue.

Answers (0)