Skip to Content
6
Former Member
May 28, 2014 at 02:22 PM

Encryption key for Android SMP application

43 Views

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()); ?