Agent System POND 1.2 (28.2.2002)

FIM.payment
Interface Payment

All Superinterfaces:
Serializable, XMLEncodeable
All Known Implementing Classes:
PaymentBase

public interface Payment
extends XMLEncodeable, Serializable

A class representing the payment for a certain invoice. The actual payment information is implementation specific. The payment can be signed.

Version:
1.0
Author:
Michael Sonntag
See Also:
Invoice

Method Summary
 String characteristics()
          Retrieve a characteristic string for this type of payment (e. g.
 Certificate getCertificate()
          Retrieve the certificate passed in upon signing.
 byte[] getEncoded()
          Retrieve the payment in encoded form to be used for signing.
 Invoice getInvoice()
          Retrieve the invoice this payment is for.
 boolean isSigned()
          Check whether this payment is signed or not.
 void sign(String signAlgorithm, PrivateKey pk, Certificate cert)
          Sign the payment.
 String toString()
          Retrieve the payment as a string, suitable for presenting to the user in a very simple form.
 void verifySignature(String provider)
          Verify the signature of the invoice based on the certificate contained.
 void verifySignature(String provider, PublicKey pk)
          Verify the signature of the invoice based on the public key passed in.
 
Methods inherited from interface FIM.Util.XML.XMLEncodeable
decodeXMLElement, getAsSerializable, getAsXMLElement
 

Method Detail

getInvoice

public Invoice getInvoice()
Retrieve the invoice this payment is for.
Returns:
the invoice

isSigned

public boolean isSigned()
Check whether this payment is signed or not.
Returns:
true if the payment is signed

sign

public void sign(String signAlgorithm,
                 PrivateKey pk,
                 Certificate cert)
          throws InvalidKeyException,
                 NoSuchAlgorithmException
Sign the payment.
Parameters:
signAlgorithm - the algorithm to be used for signing
pk - the private key to be used for signing
cert - the certificate of the public key associated with the private key (can be null)
Throws:
InvalidKeyException - if the private key is invalid
NoSuchAlgorithmException - if the algorithm is not supported

getCertificate

public Certificate getCertificate()
Retrieve the certificate passed in upon signing. Is null if non provided then.
Returns:
the certificate of the signer or null

verifySignature

public void verifySignature(String provider)
                     throws NoSuchAlgorithmException,
                            InvalidKeyException,
                            NoSuchProviderException,
                            SignatureException
Verify the signature of the invoice based on the certificate contained. Will fail if not signed or if no certificate is present.
Parameters:
provider - the security provider to be used for checking. if null, the standard provider is used
Throws:
InvalidKeyException - if the public key is invalid
NoSuchAlgorithmException - if the algorithm used for signing is not supported
InvalidKeyException - if the key in the certificate is erroneous
NoSuchProviderException - if the security provider could not be found
SignatureException - if the signature is invalid

verifySignature

public void verifySignature(String provider,
                            PublicKey pk)
                     throws NoSuchAlgorithmException,
                            InvalidKeyException,
                            NoSuchProviderException,
                            SignatureException
Verify the signature of the invoice based on the public key passed in. Will fail if not signed. Teh certificate included is ignored.
Parameters:
provider - the security provider to be used for checking. if null, the standard provider is used
pk - the public key to use for verification. If null, the key from the certificate is used (if no certificate in this case, verification fails)
Throws:
NoSuchAlgorithmException - if the algorithm used for signing is not supported
InvalidKeyException - if the public key (or the key in the certificate) is invalid
NoSuchProviderException - if the security provider could not be found
SignatureException - if the signature is invalid

characteristics

public String characteristics()
Retrieve a characteristic string for this type of payment (e. g. "Creditcard").
Returns:
the characteristic of this payment

getEncoded

public byte[] getEncoded()
Retrieve the payment in encoded form to be used for signing. Does NOT include the signing information itself (which will be created based on the result!). Must be exactly the same on all calls and if the content is the same.
Returns:
the payment in encoded form

toString

public String toString()
Retrieve the payment as a string, suitable for presenting to the user in a very simple form.
Specified by:
toString in interface XMLEncodeable
Overrides:
toString in class Object
Returns:
the payment encoded as a string

Agent System POND 1.2 (28.2.2002)

Submit a bug

Copyright 2001,2002 Michael Sonntag & Institute for Information Processing and Microprocessor Technology (FIM), Johannes-Kepler-University Linz, Altenbergerstr. 69, A-4040 Linz, Austria.