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

Interface for creating an RFC 3161 timestamp. More...

#include <SignDocSDK-cpp.h>

Inheritance diagram for TimeStamper:
LibraryTimeStamper

Public Types

enum  StampResult {
  sr_ok, sr_invalid_input, sr_timeout, sr_stopped,
  sr_tcp_error, sr_ssl_error, sr_http_error, sr_server_error,
  sr_invalid_response
}
 Return value of stamp(). More...
 
enum  StampFlags { sf_dont_check_revocation = 0x01, sf_dont_hash = 0x02 }
 Flags for stamp(). More...
 

Public Member Functions

virtual const char * getHashAlgorithmOID () const =0
 Get the object ID of the message digest algorithm. More...
 
virtual const char * getFallbackHashAlgorithmOID () const =0
 Get the object ID of the fallback message digest algorithm. More...
 
virtual StampResult stamp (const unsigned char *aHashPtr, size_t aHashSize, unsigned aRandomNonceSize, int aFlags, std::vector< unsigned char > &aOutput, int &aStatus, unsigned &aFailureInfo)=0
 Create a time-stamp request, send the request to the configured time stamping authority, and evaluate the response. 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 stamp() call. More...
 
virtual SIGNDOC_TimeStamper * getImpl ()=0
 Internal. More...
 

Protected Member Functions

virtual ~TimeStamper ()
 Destructor. More...
 

Detailed Description

Interface for creating an RFC 3161 timestamp.

An object implementing this interface is passed to SignPKCS7::sign() if a time stamp is required for the signature.

Member Enumeration Documentation

enum StampFlags

Flags for stamp().

Enumerator
sf_dont_check_revocation 

Do not check revocation.

Set this flag if you need only the size of the timestamp.

sf_dont_hash 

Do not hash the document message digest again.

Return value of stamp().

Enumerator
sr_ok 

Success.

sr_invalid_input 

Invalid argument or invalid time-stamp request.

sr_timeout 

Timeout.

sr_stopped 

Transaction interrupted by stop().

sr_tcp_error 

Some failure at the TCP/IP layer.

sr_ssl_error 

Some failure at the SSL/TLS layer.

sr_http_error 

Some failure at the HTTP layer.

sr_server_error 

The server failed to create the time stamp (according to PKIStatus).

sr_invalid_response 

The response from the server is invalid.

Constructor & Destructor Documentation

virtual ~TimeStamper ( )
inlineprotectedvirtual

Destructor.

Member Function Documentation

virtual const char* getErrorMessage ( ) const
pure virtual

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

Returns
A pointer to a string describing the reason for the failure of the last stamp() call. The string is empty if the last call succeeded. The pointer is valid until this object is destroyed or stamp() is called again. The string is ASCII-encoded, the error message is in English.

Implemented in LibraryTimeStamper.

virtual const char* getFallbackHashAlgorithmOID ( ) const
pure virtual

Get the object ID of the fallback message digest algorithm.

Returns
A pointer to the object ID of the fallback message digest algorithm as string, e.g., "1.3.14.3.2.26" for SHA-1. The pointer is valid until the object implementing the TimeStamper interface is destroyed.

Implemented in LibraryTimeStamper.

virtual const char* getHashAlgorithmOID ( ) const
pure virtual

Get the object ID of the message digest algorithm.

Before stamp() has been called, this function returns the message digest algorithm expected to be used for the time-stamp token.

After stamp() has been called, this function returns the message digest algorithm actually used for the time-stamp token. If the two calls return different values, stamp() should be called again.

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 is valid until the object implementing the TimeStamper interface is destroyed.

Implemented in LibraryTimeStamper.

virtual SIGNDOC_TimeStamper* getImpl ( )
pure virtual

Internal.

Implemented in LibraryTimeStamper.

virtual StampResult stamp ( const unsigned char *  aHashPtr,
size_t  aHashSize,
unsigned  aRandomNonceSize,
int  aFlags,
std::vector< unsigned char > &  aOutput,
int &  aStatus,
unsigned &  aFailureInfo 
)
pure virtual

Create a time-stamp request, send the request to the configured time stamping authority, and evaluate the response.

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

Parameters
[in]aHashPtrA pointer to the first octet of the document message digest to be hashed (unless sf_dont_hash is set in aFlags) and 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 in the time-stamp request.
[in]aFlagsFlags modifying the behavior of this function, see enum StampFlags.
[out]aOutputThe time-stamp token sent by the server will be stored here as blob if this function returns sr_ok. Otherwise, aOutput will be empty.
[out]aStatusThe PKIStatus value of the response from the server will be stored here. 0 if no response from the server is available.
[out]aFailureInfoThe PKIFailureInfo value of the response from the server will be stored here. 0 if no response from the server is available.
Returns
sr_ok if successful. Use getErrorMessage() to get an error message.
See also
getErrorMessage(), getHashAlgorithmOID(), stop()

Implemented in LibraryTimeStamper.

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() will return sr_stopped.

Implemented in LibraryTimeStamper.


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