webfunds.sox
Class Utils

java.lang.Object
  |
  +--webfunds.sox.Utils

public final class Utils
extends java.lang.Object

A set of utility functions.


Method Summary
static boolean byteEquals(byte[] one, byte[] two)
          Read a PrivateKey object from a file
static byte exampleByte()
          Return data byte(s) that is rubbish.
static byte[] exampleData()
           
static byte[] exampleData(int len)
           
static long exampleLong()
           
static java.math.BigInteger examplePosBigInt()
           
static java.math.BigInteger examplePosBigInt(int len)
           
static java.security.PrivateKey examplePrivateKey()
           
static java.security.PublicKey examplePublicKey()
          Don't try and do public key on this!
static java.lang.String exampleString()
           
static java.lang.String exampleString(int len)
           
static byte[] getDataFromFile(java.lang.String filename)
          Read a file into a byte array
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

getDataFromFile

public static byte[] getDataFromFile(java.lang.String filename)
                              throws java.io.IOException
Read a file into a byte array
Parameters:
filename - The filename containing the data
Returns:
The byte array read from the file

byteEquals

public static boolean byteEquals(byte[] one,
                                 byte[] two)
Read a PrivateKey object from a file
Parameters:
filename - The filename containing the certificate
Returns:
The PrivateKey from the file

exampleByte

public static byte exampleByte()
Return data byte(s) that is rubbish. None of these routines are cryptographically secure, in fact they are not even vaguely random, and only intended for class unit tests.
Returns:
an example byte

exampleLong

public static long exampleLong()
Returns:
example long, made of 8 example bytes

exampleData

public static byte[] exampleData(int len)
Returns:
byte array with len example bytes in it, never null

exampleData

public static byte[] exampleData()
Returns:
unprintable byte array from 0 to 32 bytes long, never null

exampleString

public static java.lang.String exampleString(int len)
Returns:
printable string len bytes long, never null

exampleString

public static java.lang.String exampleString()
Returns:
printable string from 0 to 32 bytes long, never null

examplePublicKey

public static java.security.PublicKey examplePublicKey()
Don't try and do public key on this!

examplePrivateKey

public static java.security.PrivateKey examplePrivateKey()

examplePosBigInt

public static java.math.BigInteger examplePosBigInt(int len)
Parameters:
len - bytes, where len >= 1

examplePosBigInt

public static java.math.BigInteger examplePosBigInt()
Returns:
something from 8 bytes to 16 bytes worth of big int.