com.buglabs.bug.module.pb
Class PBModuleControl
java.lang.Object
com.buglabs.bug.module.pb.PBModuleControl
- All Implemented Interfaces:
- IPB
public class PBModuleControl
- extends java.lang.Object
- implements IPB
|
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 |
PBModuleControl
public PBModuleControl(PB pb,
int slotId)
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 usernamepassword - 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 usernamepassword - PSD passworddataToSign - the data the PSD is to signdataToSignLength - how much of dataToSign we wish to signdataRequest - TODO: 4 byte array for?debitAmount - TODO: 4 byte array for debit amount, but what unitssignatureType - TODO: meaning?signature - returned signaturecertificate - returned certificatesignedData - returned signed dataretLengths - 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 usernamepassword - PSD passworddata - array containing the signed datadataLength - length of the datasignature - signature from a previous call to generateSignaturesignatureLength - length of the signaturesignatureType - TODO - not sure what valid values are
- Returns:
- true if signature was verified, and hence is valid, false otherwise
- Throws:
PBException