com.buglabs.bug.module.pb
Class PBModuleControl

java.lang.Object
  extended by com.buglabs.bug.module.pb.PBModuleControl
All Implemented Interfaces:
IPB

public class PBModuleControl
extends java.lang.Object
implements IPB


Constructor Summary
PBModuleControl(PB pb, int slotId)
           
 
Method Summary
 void generateSignature(java.lang.String username, java.lang.String password, byte[] dataToSign, int dataToSignLength, byte[] dataRequest, byte[] debitAmount, int signatureType, byte[] signature, byte[] certificate, byte[] signedData, int[] retLengths)
           
 java.util.Date getDateTime(java.lang.String username, java.lang.String password)
          Retrieve the current date and time from the PSD.
 boolean isSignatureValid(java.lang.String username, java.lang.String password, byte[] data, int dataLength, byte[] signature, int signatureLength, int signatureType)
          Verify a signature.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PBModuleControl

public PBModuleControl(PB pb,
                       int slotId)
Method Detail

getDateTime

public java.util.Date getDateTime(java.lang.String username,
                                  java.lang.String password)
                           throws PBException
Description copied from interface: IPB
Retrieve the current date and time from the PSD.

Specified by:
getDateTime in interface IPB
Parameters:
username - PSD username
password - PSD password
Returns:
PSD timestamp
Throws:
PBException

generateSignature

public void generateSignature(java.lang.String username,
                              java.lang.String password,
                              byte[] dataToSign,
                              int dataToSignLength,
                              byte[] dataRequest,
                              byte[] debitAmount,
                              int signatureType,
                              byte[] signature,
                              byte[] certificate,
                              byte[] signedData,
                              int[] retLengths)
                       throws PBException
Specified by:
generateSignature in interface IPB
Parameters:
username - PSD username
password - PSD password
dataToSign - the data the PSD is to sign
dataToSignLength - how much of dataToSign we wish to sign
dataRequest - TODO: 4 byte array for?
debitAmount - TODO: 4 byte array for debit amount, but what units
signatureType - TODO: meaning?
signature - returned signature
certificate - returned certificate
signedData - returned signed data
retLengths - lengths: signature, certificate, data as [0], [1], [2] TODO: ditch retLengths since it is very ugly, but keep ability to let caller predefine the memory; would have used streams if I could have figured out how to get them into JNI-land.
Throws:
PBException

isSignatureValid

public boolean isSignatureValid(java.lang.String username,
                                java.lang.String password,
                                byte[] data,
                                int dataLength,
                                byte[] signature,
                                int signatureLength,
                                int signatureType)
                         throws PBException
Description copied from interface: IPB
Verify a signature.

Specified by:
isSignatureValid in interface IPB
Parameters:
username - PSD username
password - PSD password
data - array containing the signed data
dataLength - length of the data
signature - signature from a previous call to generateSignature
signatureLength - length of the signature
signatureType - TODO - not sure what valid values are
Returns:
true if signature was verified, and hence is valid, false otherwise
Throws:
PBException