com.cybersource.ws.client
Class Signature

java.lang.Object
  extended bycom.cybersource.ws.client.Signature

public class Signature
extends java.lang.Object

Contains the method that signs the requests.


Constructor Summary
Signature()
           
 
Method Summary
static com.cybersource.security.identity.Identity cacheIdentity(java.lang.String merchantID, java.io.File keyFile)
          Reads the identity for the given merchant from the pkcs12 file and adds it to the cache.
static void initializeContext()
          Initializes the context used by the security library.
static org.w3c.dom.Document sign(java.lang.String merchantID, java.io.File keyFile, org.w3c.dom.Document doc)
          Signs the given document.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Signature

public Signature()
Method Detail

sign

public static org.w3c.dom.Document sign(java.lang.String merchantID,
                                        java.io.File keyFile,
                                        org.w3c.dom.Document doc)
                                 throws SignException
Signs the given document.

Parameters:
merchantID - the merchant id.
keyFile - File object representing the merchant's key file.
doc - the document to sign.
Throws:
SignException - if the signing fails for any reason. Its inner exception will contain the actual exception.

initializeContext

public static void initializeContext()
                              throws SignException
Initializes the context used by the security library. If you experience significant delay on the first request, you may call this method in some start-up routine to avoid delaying the first request. The start-up routine must be executed before any threads that use the clients are spawned as this method is not synchronized.

Throws:
SignException - if initialization fails.

cacheIdentity

public static com.cybersource.security.identity.Identity cacheIdentity(java.lang.String merchantID,
                                                                       java.io.File keyFile)
                                                                throws SignException
Reads the identity for the given merchant from the pkcs12 file and adds it to the cache. This method is called once and only once for each merchant id not yet in the cache. If you experience significant delay on the first request, you may call this method in some start-up routine to avoid delaying the first request. You would want to call it for each merchantID that will be used by the application. Signature.initializeContext() must precede any Signature.cacheIdentity() calls.

Parameters:
merchantID - the merchant id.
keyFile - File object representing the merchant's key file.
Throws:
SignException - if the retrieval or caching of identity fails.


Copyright © 2003-2006 CyberSource Corporation. All Rights Reserved.