SignDoc SDK (C++)  5.0.1.29
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Friends Pages
UserTimeStamper Class Referenceabstract

Bsae class for user-provided timestamping. More...

#include <SignDocSDK-cpp.h>

Public Types

enum  Result {
  r_ok, r_invalid_argument, r_timeout, r_stopped,
  r_error
}
 Return value of stamp(). More...
 
enum  Flags { f_get_size = 0x01 }
 Flags for stamp(). More...
 

Public Member Functions

 UserTimeStamper ()
 Constructor. More...
 
virtual ~UserTimeStamper ()
 Destructor. More...
 
virtual ReturnCode init (const SignDocSignatureParameters *aParameters, const std::string &aHashAlgorithmOID, const std::string &aOverrideURL, const std::string &aDocumentHashAlgorithmOID)=0
 Set parameters. More...
 
virtual const char * getHashAlgorithmOID () const =0
 Get the object ID of the message digest algorithm. More...
 
virtual Result stamp (const unsigned char *aHashPtr, size_t aHashSize, unsigned aRandomNonceSize, int aFlags, std::vector< unsigned char > &aOutput, size_t &aSize)=0
 Create a time stamp. More...
 
virtual void stop ()=0
 Interrupt a stamp() call from another thread. More...
 
virtual const char * getErrorMessage () const =0
 Get an error message for the last init() or stamp() call. More...
 
SIGNDOC_UserTimeStamper * getImpl ()
 Internal. More...
 

Detailed Description

Bsae class for user-provided timestamping.

You can derive from this class and pass the object to SignDocSignatureParameters::setTimeStamper().

Any exception object thrown must be derived from std::exception.

Member Enumeration Documentation

enum Flags

Flags for stamp().

Enumerator
f_get_size 

Get the size only.

This flag is set if only the size of the timestamp is needed.

enum Result

Return value of stamp().

Enumerator
r_ok 

Success.

r_invalid_argument 

Invalid argument.

r_timeout 

Timeout.

r_stopped 

Transaction interrupted by stop().

r_error 

Error.

Constructor & Destructor Documentation

UserTimeStamper ( )
inline

Constructor.

virtual ~UserTimeStamper ( )
inlinevirtual

Destructor.

Member Function Documentation

virtual const char* getErrorMessage ( ) const
pure virtual

Get an error message for the last init() or stamp() call.

This function must not throw any exception except for std::bad_alloc.

Returns
A pointer to a string describing the reason for the failure of the last init() or stamp() call. The pointer shall be valid until init() or stamp() is called or this object is destroyed. The string shall be ASCII-encoded, the error message shall be in English.
virtual const char* getHashAlgorithmOID ( ) const
pure virtual

Get the object ID of the message digest algorithm.

This function shall return the message digest algorithm expected to be used for the time-stamp token. If you know in advance that the algorithm specified in the SignDocSignatureParameters object passed to init() isn't supported, this function should return a supported message digest algorithm.

If the message digest algorithm turns out to be unsupported, stamp() should return a TimeStampResp with badAlg in failInfo to make falling back to another message digest algorithm work.

Returns
A pointer to the object ID of the message digest algorithm as string, e.g., "1.3.14.3.2.26" for SHA-1. The pointer shall be valid until this object is destroyed.
SIGNDOC_UserTimeStamper* getImpl ( )
inline

Internal.

virtual ReturnCode init ( const SignDocSignatureParameters aParameters,
const std::string &  aHashAlgorithmOID,
const std::string &  aOverrideURL,
const std::string &  aDocumentHashAlgorithmOID 
)
pure virtual

Set parameters.

Use SignDocSignatureParameters::getInteger() and SignDocSignatureParameters::getString() to retrieve parameters.

For your convenience, the hash algorithm configured in the SignDocSignatureParameters object is passed in aHashAlgorithmOID, you don't have to compute it yourself from aParameters and aDocumentHashAlgorithmOID.

Parameters
[in]aParametersThe SignDocSignatureParameters object passed to SignDocDocument::addSignature().
[in]aHashAlgorithmOIDObject identifier of the hash algorithm computed from string parameters "TimeStampHashAlgorithm" of aParameters and (if the value is "default") the document hash algorithm. See also aDocumentHashAlgorithmOID.
[in]aOverrideURLThe time-stamping URL coming from the PDF document. This URL shall override the URL from aParameters if non-empty.
[in]aDocumentHashAlgorithmOIDObject identifier of the hash algorithm used for the document hash.
Returns
ReturnCode::rc_ok iff successful.
See also
getErrorMessage()
virtual Result stamp ( const unsigned char *  aHashPtr,
size_t  aHashSize,
unsigned  aRandomNonceSize,
int  aFlags,
std::vector< unsigned char > &  aOutput,
size_t &  aSize 
)
pure virtual

Create a time stamp.

The signature in the returned time-stamp token need not verified by this function.

Parameters
[in]aHashPtrA pointer to the first octet of the document message digest to be signed.
[in]aHashSizeThe size (in octets) of the document message digest pointed to by aHashPtr.
[in]aRandomNonceSizeThe size (in octets, 1 through 256) of the random nonce to be used in the time-stamp request (if time-stamp requests are used).
[in]aFlagsFlags modifying the behavior of this function, see enum Flags.
[out]aOutputThe time-stamp token or time-stamp response shall be stored here as blob if this function returns r_ok and f_get_size is not set in aFlags.
[out]aSizeThe expected size of the time-stamp token shall be stored here if this function returns r_ok and f_get_size is set in aFlags.
Returns
r_ok iff successful.
See also
getErrorMessage(), getHashAlgorithmOID(), stop()
virtual void stop ( )
pure virtual

Interrupt a stamp() call from another thread.

If this function is called while stamp() is waiting for the response from the server, stamp() shall return r_stopped.


The documentation for this class was generated from the following file: