ecash.kernel
Class Note

java.lang.Object
  |
  +--ecash.kernel.Note
All Implemented Interfaces:
java.io.Serializable

public class Note
extends java.lang.Object
implements java.io.Serializable

Contains a bank note and its corresponding signed hash. This allows a user to check that the bank note is valid, and of course that the bank signed it.

Author:
Michel Deriaz
See Also:
Serialized Form

Constructor Summary
Note(java.math.BigInteger bigM, java.math.BigInteger signedNote)
          Constructs a Note object from a bank note, called bigM, and its corresponding signed hash, called signedNote.
Note(java.lang.String value)
          Re-build the object from it's string representation.
 
Method Summary
 boolean checkRIS(java.math.BigInteger challengeRIS, RISPart risPart)
          Checks if the revealed part of the RIS is correct.
 boolean checkSignature(PubKey pubKey)
          Checks if the signature on the note is valid, or that the hash of the signed note corresponds to the note.
 java.lang.String getAmount()
          Returns the amount of the note.
 java.math.BigInteger getBigM()
          Returns the bank note.
 java.math.BigInteger getSignedNote()
          Returns the signed hash of the note.
static Note load(java.lang.String filename)
          Re-build the object from it's file representation.
 void save(java.lang.String filename)
          Saves this object into it's file representation.
 java.lang.String toString()
          Returns a string representation of this Note.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

Note

public Note(java.math.BigInteger bigM,
            java.math.BigInteger signedNote)
Constructs a Note object from a bank note, called bigM, and its corresponding signed hash, called signedNote.

Parameters:
bigM - the bank note
signedNote - a signed hash of the note

Note

public Note(java.lang.String value)
Re-build the object from it's string representation.

Parameters:
value - the string representation of the object
Method Detail

getBigM

public java.math.BigInteger getBigM()
Returns the bank note.

Returns:
bigM, the bank note

getSignedNote

public java.math.BigInteger getSignedNote()
Returns the signed hash of the note.

Returns:
signedNote, a signed hash of the note

checkSignature

public boolean checkSignature(PubKey pubKey)
Checks if the signature on the note is valid, or that the hash of the signed note corresponds to the note.

Parameters:
pubKey - the public key of the bank
Returns:
a boolean indicating whether the signature is correct or not

checkRIS

public boolean checkRIS(java.math.BigInteger challengeRIS,
                        RISPart risPart)
Checks if the revealed part of the RIS is correct.

Parameters:
challengeRIS - the challenge asked by the seller
risPart - the revealed part of the RIS, given by the buyer
Returns:
a boolean indicating whether the RIS is correct or not

getAmount

public java.lang.String getAmount()
Returns the amount of the note.

Returns:
the amount of the note

load

public static Note load(java.lang.String filename)
Re-build the object from it's file representation.

Parameters:
filename - the filename

save

public void save(java.lang.String filename)
Saves this object into it's file representation.

Parameters:
filename - the filename

toString

public java.lang.String toString()
Returns a string representation of this Note.

Overrides:
toString in class java.lang.Object
Returns:
a string representation of this Note