com.ibm.atp.auth
Class ByteSequence

java.lang.Object
  |
  +--com.ibm.atp.auth.ByteSequence
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable
Direct Known Subclasses:
Challenge, Response, SharedSecret

public class ByteSequence
extends java.lang.Object
implements java.lang.Cloneable, java.io.Serializable

The ByteSequence class is byte sequence using for authentication.

Version:
1.00 $Date: 2001/07/28 06:33:45 $
Author:
ONO Kouichi
See Also:
Challenge, SharedSecret, Serialized Form

Constructor Summary
ByteSequence(byte[] seq)
          Constructor creates byte sequence as a copy of given byte sequence.
ByteSequence(ByteSequence seq)
          Constructor creates byte sequence as a copy of given byte sequence.
ByteSequence(int length)
          Constructor creates a secure random generator to generate byte sequence.
ByteSequence(int length, java.lang.String str)
          Constructor creates byte sequence as a copy of length and given hexadecimal string of encoded bytes.
ByteSequence(int length, java.lang.String str, java.lang.String delimiters)
          Constructor creates byte sequence as a copy of length and given hexadecimal string of encoded bytes.
ByteSequence(java.lang.String str)
          Constructor creates byte sequence as a copy of given string.
 
Method Summary
 void append(byte b)
          Append a given byte into the byte sequence.
 void append(byte[] seq)
          Append a given byte sequence into the byte sequence.
 void append(ByteSequence seq)
          Append a given byte sequence object into the byte sequence.
 void append(java.lang.String str)
          Append a given string into the byte sequence.
protected  java.lang.Object clone()
          Creates a clone of the byte sequence.
 void copy(byte[] seq)
          Copy a byte sequence using for authentication.
 void copy(ByteSequence seq)
          Copy a byte sequence object as a byte sequence using for authentication.
 void copy(java.lang.String str)
          Copy a string as byte sequence using for authentication.
 boolean equals(byte[] seq)
          Verifies the byte sequence equals to given byte sequence.
 boolean equals(ByteSequence seq)
          Verifies the byte sequence equals to given byte sequence.
 boolean equals(java.lang.Object obj)
          Verifies the byte sequence equals to given object.
 int length()
          Returns length of byte sequence.
 byte[] sequence()
          Returns current byte sequence.
 java.lang.String toString()
          Returns a hexadecimal string representation of the byte sequence.
 
Methods inherited from class java.lang.Object
finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ByteSequence

public ByteSequence(byte[] seq)
Constructor creates byte sequence as a copy of given byte sequence.
Parameters:
seq - a byte sequence to be copied

ByteSequence

public ByteSequence(int length)
Constructor creates a secure random generator to generate byte sequence.
Parameters:
length - length of byte sequence to be generated

ByteSequence

public ByteSequence(int length,
                    java.lang.String str)
Constructor creates byte sequence as a copy of length and given hexadecimal string of encoded bytes. If length is 0, calculates the number of encoded bytes and generates byte sequence.
Parameters:
length - length of byte sequence
str - a hexadecimal string to be copied
See Also:
toString

ByteSequence

public ByteSequence(int length,
                    java.lang.String str,
                    java.lang.String delimiters)
Constructor creates byte sequence as a copy of length and given hexadecimal string of encoded bytes. If length is 0, calculates the number of encoded bytes and generates byte sequence.
Parameters:
length - length of byte sequence
str - a hexadecimal string to be copied
delimiters - delimiters between hexadecimal numbers
See Also:
toString

ByteSequence

public ByteSequence(ByteSequence seq)
Constructor creates byte sequence as a copy of given byte sequence.
Parameters:
seq - a byte sequence to be copied

ByteSequence

public ByteSequence(java.lang.String str)
Constructor creates byte sequence as a copy of given string.
Parameters:
str - a string to be copied
Method Detail

append

public void append(byte[] seq)
Append a given byte sequence into the byte sequence.
Parameters:
seq - a byte sequence to be appended

append

public void append(byte b)
Append a given byte into the byte sequence.
Parameters:
b - a byte to be appended

append

public void append(ByteSequence seq)
Append a given byte sequence object into the byte sequence.
Parameters:
seq - a byte sequence object to be appended

append

public void append(java.lang.String str)
Append a given string into the byte sequence.
Parameters:
str - a string to be appended

clone

protected java.lang.Object clone()
Creates a clone of the byte sequence.
Overrides:
clone in class java.lang.Object
Parameters:
seq - a byte sequence
See Also:
Object.clone(), Cloneable

copy

public void copy(byte[] seq)
Copy a byte sequence using for authentication. If given byte sequence is shorter than the required byte sequence, fill the byte sequence by 0s. If given byte sequence is longer than the required byte sequence, truncate the rest of given byte sequence.
Parameters:
seq - a byte sequence

copy

public void copy(ByteSequence seq)
Copy a byte sequence object as a byte sequence using for authentication.
Parameters:
seq - a byte sequence object to be copied as a byte sequence using for authentication

copy

public void copy(java.lang.String str)
Copy a string as byte sequence using for authentication.
Parameters:
str - a string to be copied as a byte sequence using for authentication

equals

public boolean equals(byte[] seq)
Verifies the byte sequence equals to given byte sequence. If given byte sequence does not equal to the required byte sequence, return false.
Parameters:
seq - a byte sequence
Returns:
true if the byte sequence is same; otherwise false.

equals

public boolean equals(ByteSequence seq)
Verifies the byte sequence equals to given byte sequence.
Parameters:
seq - a byte sequence
Returns:
true if the byte sequence is same; otherwise false.

equals

public boolean equals(java.lang.Object obj)
Verifies the byte sequence equals to given object.
Overrides:
equals in class java.lang.Object
Parameters:
obj - a object
Returns:
true if the object has same byte sequence; otherwise false.
See Also:
Object.equals(java.lang.Object)

length

public int length()
Returns length of byte sequence.
Returns:
length of byte sequence

sequence

public byte[] sequence()
Returns current byte sequence.
Returns:
current byte sequence using for authentication.

toString

public java.lang.String toString()
Returns a hexadecimal string representation of the byte sequence. The series of hexadecimal strings are the contents of byte sequence.
Overrides:
toString in class java.lang.Object
Returns:
a hexadecimal string representation of the byte sequence
See Also:
Object.toString()