webfunds.token
Class TokenSigner
java.lang.Object
|
+--webfunds.sox.Encodable
|
+--webfunds.token.Token
|
+--webfunds.token.TokenSigner
- public abstract class TokenSigner
- extends Token
This class represents a proto token -- a coin before withdrawal.
- See Also:
- Serialized Form
|
Field Summary |
static int |
SIGNER_ORIGINAL
The version number for this structure:
0: current |
static int |
TOK_NEW
The state that the token is in within this phase
(generally made by the mint according to the protocol). |
static int |
TOK_SIGNED
The state that the token is in within this phase
(generally made by the mint according to the protocol). |
static int |
TOK_TRANS
The state that the token is in within this phase
(generally made by the mint according to the protocol). |
static int |
TOK_VERIFIED
The state that the token is in within this phase
(generally made by the mint according to the protocol). |
| Fields inherited from class webfunds.token.Token |
expiry,
item,
log,
phase,
PHASE_BUILDER,
PHASE_DEAD,
PHASE_SIGNER,
PHASE_SPEND,
phaseVersion,
ps,
series,
state,
subversion,
TOK_ORIGINAL,
type |
|
Constructor Summary |
TokenSigner()
Create an uninitialised token. |
TokenSigner(byte[] buf)
Construct a token object from a byte array
that was previously returned from the encode()
method of a token object. |
TokenSigner(java.io.InputStream is)
Construct a token object from data in an input stream,
where the data was previously returned from the encode()
method of a token object. |
|
Method Summary |
void |
decode(java.io.InputStream is)
Update this token object with the values from
a token encoded as a byte array (such as previously
returned from the encode() method of a token object). |
void |
encode(java.io.OutputStream os)
Encode a token as a byte array, suitable for
sending to third parties for depositing. |
boolean |
isNew()
|
boolean |
isSigned()
|
boolean |
isTransacted()
|
boolean |
isVerified()
|
protected void |
setSigned()
|
void |
setTransacted()
|
abstract void |
sign(java.security.SecureRandom sr,
AbstractPrivateParams params)
User blinds a raw coin and turns it into a Protocoin. |
java.lang.String |
toString()
|
| Methods inherited from class webfunds.token.Token |
equals,
getExpiry,
getItem,
getLog,
getPhase,
getPhaseString,
getPhaseVersion,
getQty,
getSeries,
getState,
getSubVersion,
getType,
getUniqueId,
getVersion,
isBuilder,
isDead,
isSigner,
isSpender,
isValidPhase,
setState,
vString |
| 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 |
SIGNER_ORIGINAL
public static final int SIGNER_ORIGINAL
- The version number for this structure:
0: current
TOK_NEW
public static final int TOK_NEW
- The state that the token is in within this phase
(generally made by the mint according to the protocol).
How it is set and advanced is up to the higher layers.
May be ignored, may use the following TOK numbers.
Only the low-order single unsigned byte is saved & restored.
TOK_VERIFIED
public static final int TOK_VERIFIED
- The state that the token is in within this phase
(generally made by the mint according to the protocol).
How it is set and advanced is up to the higher layers.
May be ignored, may use the following TOK numbers.
Only the low-order single unsigned byte is saved & restored.
TOK_SIGNED
public static final int TOK_SIGNED
- The state that the token is in within this phase
(generally made by the mint according to the protocol).
How it is set and advanced is up to the higher layers.
May be ignored, may use the following TOK numbers.
Only the low-order single unsigned byte is saved & restored.
TOK_TRANS
public static final int TOK_TRANS
- The state that the token is in within this phase
(generally made by the mint according to the protocol).
How it is set and advanced is up to the higher layers.
May be ignored, may use the following TOK numbers.
Only the low-order single unsigned byte is saved & restored.
TokenSigner
public TokenSigner()
- Create an uninitialised token.
Call prototype() with some params to make it a real proto-token.
The series is unknown until signing (mint can use a different key).
- Parameters:
type - of token, being the blinding or coin schemesubversion - is the version of the parent coin classlog - the coin size, log base 2 of quantity
TokenSigner
public TokenSigner(byte[] buf)
throws TokenPacketException
- Construct a token object from a byte array
that was previously returned from the encode()
method of a token object.
- Parameters:
token - the previously encoded token
TokenSigner
public TokenSigner(java.io.InputStream is)
throws TokenPacketException
- Construct a token object from data in an input stream,
where the data was previously returned from the encode()
method of a token object.
- Parameters:
is - the input stream from which to read the token data
isNew
public boolean isNew()
isVerified
public boolean isVerified()
isSigned
public boolean isSigned()
isTransacted
public boolean isTransacted()
sign
public abstract void sign(java.security.SecureRandom sr,
AbstractPrivateParams params)
throws TokenKeyException
- User blinds a raw coin and turns it into a Protocoin.
Some sort of signing process involved, done internally.
Normally called by mint (server), so it is standardised.
- Parameters:
params - includes the blinding paramaters from the mint
setSigned
protected void setSigned()
setTransacted
public void setTransacted()
decode
public void decode(java.io.InputStream is)
throws java.io.IOException
- Update this token object with the values from
a token encoded as a byte array (such as previously
returned from the encode() method of a token object).
- Overrides:
- decode in class Token
- Parameters:
token - the previosly encoded token
encode
public void encode(java.io.OutputStream os)
throws java.io.IOException
- Encode a token as a byte array, suitable for
sending to third parties for depositing.
If the signature is not present, an unsigned
token will be encoded.
- Overrides:
- encode in class Token
- Returns:
- byte[] the token in encoded form
toString
public java.lang.String toString()
- Overrides:
- toString in class Token