aerogear-crypto 0.1.1

org.jboss.aerogear.crypto
Class Util

java.lang.Object
  extended by org.jboss.aerogear.crypto.Util

public class Util
extends Object

Utility class for platform validation and cryptographic operations


Field Summary
private static String ANDROID_ACTIVITY_CLASS
           
private static boolean IS_ANDROID
           
 
Constructor Summary
Util()
           
 
Method Summary
static byte[] checkLength(byte[] data, int size)
          Validate the length of the data provided
static int checkSize(int size, int minimumSize)
          Validate the minimum size supported by the parameter
static String formatter(Algorithm algorithm, BlockCipher.Mode mode)
          Utility method to format algorithms name in Java like way
static String formatter(BlockCipher.Mode mode, Padding padding)
          Utility method to format algorithms name in Java like way
static boolean isAndroid()
          Verify if the platform is running Android
static byte[] newBuffer(int length)
          Create a new buffer with the specified size
static byte[] newByteArray(byte[] data)
          Copy the provided data
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

IS_ANDROID

private static final boolean IS_ANDROID

ANDROID_ACTIVITY_CLASS

private static final String ANDROID_ACTIVITY_CLASS
See Also:
Constant Field Values
Constructor Detail

Util

public Util()
Method Detail

checkLength

public static byte[] checkLength(byte[] data,
                                 int size)
Validate the length of the data provided

Parameters:
data -
size -
Returns:
data provided if valid

checkSize

public static int checkSize(int size,
                            int minimumSize)
Validate the minimum size supported by the parameter

Parameters:
size -
minimumSize -
Returns:
size provided if valid

formatter

public static String formatter(Algorithm algorithm,
                               BlockCipher.Mode mode)
Utility method to format algorithms name in Java like way

Parameters:
algorithm -
mode -
Returns:
string name with the formatted algorithm

formatter

public static String formatter(BlockCipher.Mode mode,
                               Padding padding)
Utility method to format algorithms name in Java like way

Parameters:
mode -
padding -
Returns:
string name with the formatted algorithm

newBuffer

public static byte[] newBuffer(int length)
Create a new buffer with the specified size

Parameters:
length -
Returns:
new empty byte array

newByteArray

public static byte[] newByteArray(byte[] data)
Copy the provided data

Parameters:
data -
Returns:
byte array

isAndroid

public static boolean isAndroid()
Verify if the platform is running Android

Returns:
if the platform is supported

aerogear-crypto 0.1.1

Copyright © 2013 JBoss by Red Hat. All Rights Reserved.