net.robotmedia.billing.utils
Class Security

java.lang.Object
  extended by net.robotmedia.billing.utils.Security

public class Security
extends Object


Constructor Summary
Security()
           
 
Method Summary
static long generateNonce()
          Generate and register nonce
static boolean isNonceKnown(long nonce)
           
static String obfuscate(android.content.Context context, byte[] salt, String source)
          Obfuscates the source string using AES algorithm with specified salt
static void removeNonce(long nonce)
           
static String unobfuscate(android.content.Context context, byte[] salt, String obfuscated)
          Method unobfuscates the string using AES algorithm with specified salt.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Security

public Security()
Method Detail

generateNonce

public static long generateNonce()
Generate and register nonce

Returns:
nonce. This method guarantees that created nonce will be unique (i.e. there is only one instance of registered nonce)

isNonceKnown

public static boolean isNonceKnown(long nonce)

removeNonce

public static void removeNonce(long nonce)

obfuscate

@Nullable
public static String obfuscate(@Nonnull
                                        android.content.Context context,
                                        @Nullable
                                        byte[] salt,
                                        @Nullable
                                        String source)
Obfuscates the source string using AES algorithm with specified salt

Parameters:
context - context
salt - salt to beb used for obfuscation
source - string to be obfuscated
Returns:
obfuscated string. Null can be returned only if source string is null

unobfuscate

@Nullable
public static String unobfuscate(@Nonnull
                                          android.content.Context context,
                                          @Nullable
                                          byte[] salt,
                                          @Nullable
                                          String obfuscated)
Method unobfuscates the string using AES algorithm with specified salt.

Parameters:
context - context
salt - unobfuscation salt (must be provided the same as was used in obfuscation)
obfuscated - string to be unobfuscated
Returns:
unobfuscated string. Null returned in two cases: either obfuscated string is null or unobfuscation failed due to some errors


Copyright © 2013. All Rights Reserved.