|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object
|
+--webfunds.sox.Encodable
|
+--webfunds.sox.Request
This class represents a signed receipt, such as received from an issuer in response to a deposit request. SOX clients usually only create receipts using data received from the issuer.
| Field Summary | |
protected AccountId |
account
The identifer of the account for which this is a request |
static int |
REQ_not_used_yet
The version of the encoded : 1 was pre-dawn-of-time, may have been SOX-1 2 - original SOX-2, as delivered 3 - all daughter requests add their own version bytes 4 - use me next Note that Requests and their Replies have the same version number. |
static int |
REQ_ORIGINAL
The version of the encoded : 1 was pre-dawn-of-time, may have been SOX-1 2 - original SOX-2, as delivered 3 - all daughter requests add their own version bytes 4 - use me next Note that Requests and their Replies have the same version number. |
static int |
REQ_SUBS_ADD_V
The version of the encoded : 1 was pre-dawn-of-time, may have been SOX-1 2 - original SOX-2, as delivered 3 - all daughter requests add their own version bytes 4 - use me next Note that Requests and their Replies have the same version number. |
protected int |
req_version
Initialised to the current best version from the REQ_* constants. |
static int |
REQ_VERSION
The version of the encoded : 1 was pre-dawn-of-time, may have been SOX-1 2 - original SOX-2, as delivered 3 - all daughter requests add their own version bytes 4 - use me next Note that Requests and their Replies have the same version number. |
protected java.lang.String |
requestId
An identifier for the request This is used for the prevention of replay attacks since the server may choose not respond to requests with an identical id (or will return the previous reply to this request). |
protected byte[] |
sig
The signature of all other request fields |
protected long |
timestamp
The time at which this request was created Used for the prevention of replay attacks, since the server will not respond to old requests. |
| Constructor Summary | |
Request(byte[] requestData)
Construct a request object from a byte array that was previously returned from the encode() method of a request object. |
|
Request(java.io.InputStream is)
Construct a request object from data on an input stream that was previously returned from the encode() method of a request object. |
|
Request(java.lang.String requestId,
AccountId acc)
Create an unsigned request |
|
Request(java.lang.String requestId,
AccountId acc,
long timestamp)
Create an unsigned request |
|
| Method Summary | |
void |
decode(java.io.InputStream is)
Update this request object with the values from a request encoded as a byte array (such as previously returned from the encode() method of a request object). |
void |
encode(java.io.OutputStream os)
Encode a deposit request to an output stream, suitable for using with RequestPacket to send to remote servers (which use the decode() method to re-construct the object). |
boolean |
equals(java.lang.Object obj)
|
abstract Reply |
errorReply(int err)
Get an error Reply for this Request. |
AccountId |
getAccountId()
Get the account identifier of the request |
abstract java.lang.String |
getName()
Returns the name of the packet as it goes on the wire. |
java.lang.String |
getRequestId()
Get the identifier on this request Note: although a java String is used, this identifier should only contain 8-bit ascii characters. |
int |
getRequestVersion()
|
long |
getTimestamp()
Get the time and date of the request |
int |
getVersion()
|
boolean |
isSigned()
Check to see if this request is signed NOTE: This does not check the validity of the signature, only that this request has one. |
Reply |
reconstructReply(byte[] buf)
Get an error Reply for this Request. |
void |
setRequestVersion(int v)
Set the version number of this request. |
void |
setSignature(byte[] sig)
Define the signature for this request |
java.lang.String |
toString()
Convert this object to a human readable string |
boolean |
verify(java.security.PublicKey key)
Verify the signature on this request. |
| Methods inherited from class webfunds.sox.Encodable |
decode,
encode,
main,
readByteArray,
readCertificate,
readProperties,
readString,
writeByteArray,
writeCertificate,
writeProperties,
writeString |
| Methods inherited from class java.lang.Object |
clone,
finalize,
getClass,
hashCode,
notify,
notifyAll,
wait,
wait,
wait |
| Field Detail |
public static final int REQ_VERSION
public static final int REQ_ORIGINAL
public static final int REQ_SUBS_ADD_V
public static final int REQ_not_used_yet
protected int req_version
protected java.lang.String requestId
protected AccountId account
protected long timestamp
protected byte[] sig
| Constructor Detail |
public Request(java.lang.String requestId,
AccountId acc,
long timestamp)
requestId - the request identifieracc - the identifier of the account holder making the requestdate - the time of the request
public Request(java.lang.String requestId,
AccountId acc)
requestId - the request identifieracc - the identifier of the account holder making the request
public Request(byte[] requestData)
throws SOXPacketException
requestData - the previously encoded request
public Request(java.io.InputStream is)
throws SOXPacketException
requestData - the previously encoded request| Method Detail |
public int getRequestVersion()
public int getVersion()
public void setRequestVersion(int v)
public abstract java.lang.String getName()
public java.lang.String getRequestId()
public AccountId getAccountId()
public long getTimestamp()
public abstract Reply errorReply(int err)
err - is the error number to set the reply to
public Reply reconstructReply(byte[] buf)
throws SOXPacketException
err - is the error number to set the reply topublic boolean isSigned()
public void setSignature(byte[] sig)
sig - the signature to place on the request,
or if null, then the signature (if any) is removed.
public boolean verify(java.security.PublicKey key)
throws SOXKeyException
key - the key to use to verify the request
public void decode(java.io.InputStream is)
throws java.io.IOException,
SOXPacketException
is - the stream from which to read the request
public void encode(java.io.OutputStream os)
throws java.io.IOException
os - the stream on which to send the outputpublic java.lang.String toString()
public boolean equals(java.lang.Object obj)
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||