anon.pay.xml
Class XMLEasyCC

java.lang.Object
  extended by anon.pay.xml.XMLEasyCC
All Implemented Interfaces:
IXMLEncodable

public class XMLEasyCC
extends java.lang.Object
implements IXMLEncodable

XML structure for a easy cost confirmation (without mircopayment function) which is sent to the AI by the Jap

Author:
Grischan Glänzel, Bastian Voigt, Tobias Bayer, Elmar Schraml

Field Summary
private  boolean m_bOldHashFormat
           
private  java.lang.String m_cascadeID
           
private  org.w3c.dom.Document m_docTheEasyCC
           
private  int m_id
           
private  long m_lAccountNumber
           
private  long m_lTransferredBytes
           
private  java.lang.String m_priceCertHashesConcatenated
           
private  java.util.Hashtable m_priceCerts
           
private  java.lang.String m_strPIID
          The Payment Instance ID
static java.lang.String XML_ELEMENT_NAME
           
 
Fields inherited from interface anon.util.IXMLEncodable
FIELD_XML_ELEMENT_CONTAINER_NAME, FIELD_XML_ELEMENT_NAME, XML_ATTR_ID, XML_ATTR_LANGUAGE, XML_ATTR_VERSION
 
Constructor Summary
XMLEasyCC(byte[] data)
          XMLEasyCC construct a CC including a Vector of price certificates (one per mix of the cascade) id is added when the CC is stored in the BI's database, so it's not passed as an argument here
XMLEasyCC(char[] data)
           
XMLEasyCC(org.w3c.dom.Element xml)
           
XMLEasyCC(java.lang.String xml)
           
XMLEasyCC(XMLEasyCC a_copiedCc)
           
 
Method Summary
 void addTransferredBytes(long plusBytes)
          this makes the signature invalid!
private static java.lang.String createConcatenatedPriceCertHashes(java.util.Hashtable priceCerts, boolean newFormat)
           
 long getAccountNumber()
           
 java.lang.String getCascadeID()
          Deprecated. : use getConcatenatedPriceCertHashes() instead
 java.lang.String getConcatenatedPriceCertHashes()
           
 int getId()
          getId Warning: field is not set as long as the CC has not been inserted in the payment instance's database you only need it as db primary key, so there should be no need to call getId before the CC has been stored in the database
 java.util.Enumeration getMixIds()
           
 int getNrOfPriceCerts()
           
 java.lang.String getPIID()
           
 java.util.Hashtable getPriceCertHashes()
          getPriceCertElements
 long getTransferredBytes()
           
static java.lang.String getXMLElementName()
           
 boolean hasOldHashFormat()
           
private  org.w3c.dom.Element internal_toXmlElement(org.w3c.dom.Document a_doc)
           
 void setCascadeID(java.lang.String a_id)
           
 void setId(int a_id)
           
 void setPIID(java.lang.String a_piID)
          sets the PI ID.
 void setPriceCerts(java.util.Hashtable a_priceCertHashes)
          setPriceCerts: inserts the hash values of known PriceCertificates
 void setTransferredBytes(long numBytes)
          setTransferredBytes.
private  void setValues(org.w3c.dom.Element element)
           
 boolean sign(IMyPrivateKey key)
           
 org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
          Return an element that can be appended to the document.
 boolean verify(IMyPublicKey key)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

XML_ELEMENT_NAME

public static final java.lang.String XML_ELEMENT_NAME
See Also:
Constant Field Values

m_lTransferredBytes

private long m_lTransferredBytes

m_lAccountNumber

private long m_lAccountNumber

m_id

private int m_id

m_priceCerts

private java.util.Hashtable m_priceCerts

m_cascadeID

private java.lang.String m_cascadeID

m_docTheEasyCC

private org.w3c.dom.Document m_docTheEasyCC

m_priceCertHashesConcatenated

private java.lang.String m_priceCertHashesConcatenated

m_bOldHashFormat

private boolean m_bOldHashFormat

m_strPIID

private java.lang.String m_strPIID
The Payment Instance ID

Constructor Detail

XMLEasyCC

public XMLEasyCC(byte[] data)
          throws java.lang.Exception
XMLEasyCC construct a CC including a Vector of price certificates (one per mix of the cascade) id is added when the CC is stored in the BI's database, so it's not passed as an argument here

Parameters:
accountNumber - long
transferred - long
a_certificate - PKCS12
a_priceCerts - Vector
Throws:
java.lang.Exception

XMLEasyCC

public XMLEasyCC(java.lang.String xml)
          throws XMLParseException
Throws:
XMLParseException

XMLEasyCC

public XMLEasyCC(char[] data)
          throws XMLParseException
Throws:
XMLParseException

XMLEasyCC

public XMLEasyCC(org.w3c.dom.Element xml)
          throws java.lang.Exception
Throws:
java.lang.Exception

XMLEasyCC

public XMLEasyCC(XMLEasyCC a_copiedCc)
          throws XMLParseException
Throws:
XMLParseException
Method Detail

getXMLElementName

public static java.lang.String getXMLElementName()

hasOldHashFormat

public boolean hasOldHashFormat()
Returns:
boolean: true if old hash format, i.e. no position given, or all positions given as -1 (meaning not present in xml) Note that even if hasOldHashFormat is true, the keys of the hashtable will still be MixCascade.MixPosition objects, not Strings as in previous versions of this class

setValues

private void setValues(org.w3c.dom.Element element)
                throws XMLParseException
Throws:
XMLParseException

internal_toXmlElement

private org.w3c.dom.Element internal_toXmlElement(org.w3c.dom.Document a_doc)

getPIID

public java.lang.String getPIID()

setPIID

public void setPIID(java.lang.String a_piID)
sets the PI ID. This makes the signature invalid!

Parameters:
Id - of the payment instance

getId

public int getId()
getId Warning: field is not set as long as the CC has not been inserted in the payment instance's database you only need it as db primary key, so there should be no need to call getId before the CC has been stored in the database

Returns:
int

setId

public void setId(int a_id)

setCascadeID

public void setCascadeID(java.lang.String a_id)

getAccountNumber

public long getAccountNumber()

getTransferredBytes

public long getTransferredBytes()

getMixIds

public java.util.Enumeration getMixIds()

getCascadeID

public java.lang.String getCascadeID()
Deprecated. : use getConcatenatedPriceCertHashes() instead

getAIName: returns the subjectkeyidentifier of the first Mix in the Cascade

Returns:
String

getPriceCertHashes

public java.util.Hashtable getPriceCertHashes()
getPriceCertElements

Returns:
Hashtable ( key: MixCascade.MixPosition (contains subjectkeyidentifier of mix and position of mix in cascade) value: hash of price certificate )

getConcatenatedPriceCertHashes

public java.lang.String getConcatenatedPriceCertHashes()

createConcatenatedPriceCertHashes

private static java.lang.String createConcatenatedPriceCertHashes(java.util.Hashtable priceCerts,
                                                                  boolean newFormat)

getNrOfPriceCerts

public int getNrOfPriceCerts()

setPriceCerts

public void setPriceCerts(java.util.Hashtable a_priceCertHashes)
setPriceCerts: inserts the hash values of known PriceCertificates

Parameters:
a_priceCertHashes - Vector

addTransferredBytes

public void addTransferredBytes(long plusBytes)
this makes the signature invalid!


setTransferredBytes

public void setTransferredBytes(long numBytes)
setTransferredBytes. this makes the signature invalid!

Parameters:
numBytes - long

sign

public boolean sign(IMyPrivateKey key)

verify

public boolean verify(IMyPublicKey key)

toXmlElement

public org.w3c.dom.Element toXmlElement(org.w3c.dom.Document a_doc)
Description copied from interface: IXMLEncodable
Return an element that can be appended to the document. This Method must not change the document in any way!

Specified by:
toXmlElement in interface IXMLEncodable
Parameters:
a_doc - a document
Returns:
the interface as xml element