CPKIFTimeStampRequest Class Reference

#include <TimeStampRequest.h>

Inheritance diagram for CPKIFTimeStampRequest:

Inheritance graph
[legend]
Collaboration diagram for CPKIFTimeStampRequest:

Collaboration graph
[legend]

List of all members.


Detailed Description

The CPKIFTimeStampRequest class provides an interface to RFC 3161 timestamp request objects. See Obtaining a timestamp sample for sample code that generates a timestamp request, posts the request and verifies the response.
TimeStampReq ::= SEQUENCE 
{
	version INTEGER { v1(1) },
	messageImprint MessageImprint,
	--a hash algorithm OID and the hash value of the data to be time-stamped
	reqPolicy TSAPolicyId OPTIONAL,
	nonce INTEGER OPTIONAL,
	certReq BOOLEAN DEFAULT FALSE,
	extensions [0] IMPLICIT Extensions OPTIONAL 
}

TSP-enforcing: No

Definition at line 37 of file TimeStampRequest.h.


Public Member Functions

 CPKIFTimeStampRequest ()
virtual ~CPKIFTimeStampRequest (void)
int GetVersion () const
void SetMessageImprint (CPKIFMessageImprintPtr &messageImprint)
CPKIFMessageImprintPtr GetMessageImprint () const
void SetPolicy (CPKIFOIDPtr &policy)
CPKIFOIDPtr GetPolicy () const
void SetNonce (CPKIFStringPtr &nonce)
const char * GetNonce () const
void SetGenerateNonce (bool generateNonce, IPKIFMediator *m=NULL)
bool GetGenerateNonce () const
void SetReqCert (bool reqCert)
bool GetReqCert () const
bool ExtensionsPresent () const
template<class T>
boost::shared_ptr< T > GetExtension ()
CPKIFBufferPtr Encode () const
void Decode (CPKIFBufferPtr &msg)
void GetExtensionByOID (const CPKIFOID &oid, CPKIFX509ExtensionPtr &ref)
void GetEncodedExtensions (CPKIFBufferPtr &buf)

Constructor & Destructor Documentation

CPKIFTimeStampRequest::CPKIFTimeStampRequest (  ) 

Interface: External

This function creates and initializes an instance of CPKIFTimeStampRequest. The Version property is initialized to PKIFTSPv1. The GenerateNonce property is initialized to false. The ReqCert property is initialized to false.

Returns:
None

Definition at line 288 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

CPKIFTimeStampRequest::~CPKIFTimeStampRequest ( void   )  [virtual]

Interface: External

This function destroys an instance of CPKIFTimeStampRequest.

Returns:
None

Definition at line 310 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.


Member Function Documentation

int CPKIFTimeStampRequest::GetVersion (  )  const

Interface: External

This function is returns the TSP version of a request. PKIF only supports version 1 timestamp requests.

Returns:
The TSP version of a request.

Definition at line 329 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, m_impl, and TOOLKIT_TSP_ASN.

void CPKIFTimeStampRequest::SetMessageImprint ( CPKIFMessageImprintPtr &  messageImprint  ) 

Interface: External

This function is used to set the message imprint associated with a CPKIFTimeStampRequest instance.

Returns:
None
Parameters:
messageImprint  [in] Reference to a smart pointer to a CPKIFMessageImprint object containing information regarding the MessageImprint included in a TimeStampRequest

Definition at line 348 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

CPKIFMessageImprintPtr CPKIFTimeStampRequest::GetMessageImprint (  )  const

Interface: External

This function is used to get the message imprint associated with a CPKIFTimeStampRequest instance.

Returns:
The GetMessageImprint function returns a smart pointer to a CPKIFMessageImprint object containing information regarding the MessageImprint included in a TimeStampRequest, or NULL if no MessageImprint was specified.

Definition at line 367 of file TimeStampRequest.cpp.

References CACASNWRAPPER_CREATE, data, LOG_STRING_DEBUG, m_impl, and TOOLKIT_TSP_ASN.

Referenced by Encode().

void CPKIFTimeStampRequest::SetPolicy ( CPKIFOIDPtr &  policy  ) 

Interface: External

These functions are used to set the policy associated with a CPKIFTimeStampRequest instance.

Returns:
None
Parameters:
policy  [in] Reference to a smart pointer to a CPKIFOID object identifying the policy to include in a TimeStampRequest

Definition at line 422 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

CPKIFOIDPtr CPKIFTimeStampRequest::GetPolicy (  )  const

Interface: External

These functions are used to get the policy associated with a CPKIFTimeStampRequest instance.

Returns:
The GetPolicy function returns a smart pointer to a CPKIFOID object identifying the policy included in a TimeStampRequest, or NULL if no Policy was specified.

Definition at line 439 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, m_impl, and TOOLKIT_TSP_ASN.

Referenced by Encode().

void CPKIFTimeStampRequest::SetNonce ( CPKIFStringPtr nonce  ) 

Interface: External

This function is used to set the nonce associated with a CPKIFTimeStampRequest instance.

Returns:
None
Parameters:
nonce  [in] Reference to a CPKIFStringPtr object containing a NULL terminated ASCII Hex representation of a nonce value to include in a TimeStampRequest

Definition at line 466 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

const char * CPKIFTimeStampRequest::GetNonce (  )  const

Interface: External

This function is used to get the nonce associated with a CPKIFTimeStampRequest instance.

Returns:
The GetNonce function returns a const pointer to a buffer containing a NULL terminated string or NULL if no nonce has been specified (or generated). The string is an ASCII hex representation of the nonce value preceded by "0x".

Definition at line 485 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, m_impl, and TOOLKIT_TSP_ASN.

Referenced by Encode().

void CPKIFTimeStampRequest::SetGenerateNonce ( bool  generateNonce,
IPKIFMediator m = NULL 
)

Interface: External

This function is used to set an indicator that is used to turn on/off automatic nonce generation. The optional m parameter to SetGenerateNonce can be used to pass a mediator containing the IPKIFCryptoMisc interface to use when generating the nonce value. Automatic nonce generation is disabled by default.

Returns:
None
Parameters:
generateNonce  [in] Boolean value indicating whether a nonce value should be randomly generated when the TimeStampRequest is encoded
m  [in] Pointer to an IPKIFMediator to use when generating the random nonce value

Definition at line 512 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

bool CPKIFTimeStampRequest::GetGenerateNonce (  )  const

Interface: External

This function is used to get an indicator that is used to turn on/off automatic nonce generation.

Returns:
The GetGenerateNonce function returns true if nonces are randomly generated at Encode-time and false otherwise.

Definition at line 531 of file TimeStampRequest.cpp.

void CPKIFTimeStampRequest::SetReqCert ( bool  reqCert  ) 

Interface: External

This function are used to set the certificate request flag associated with a CPKIFTimeStampRequest instance. When set to true in a request, compliant TSAs return the TSA certificate along with the requested timestamp token. This value is set to false by default.

Returns:
None
Parameters:
reqCert  [in] Boolean value indicating whether a TSA should include its certificate in the resulting TimeStampResponse

Definition at line 544 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

bool CPKIFTimeStampRequest::GetReqCert (  )  const

Interface: External

This function are used to get the certificate request flag associated with a CPKIFTimeStampRequest instance. When set to true in a request, compliant TSAs return the TSA certificate along with the requested timestamp token. This value is set to false by default.

Returns:
The GetReqCert function returns the value of the ReqCert property.

Definition at line 562 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, m_impl, and TOOLKIT_TSP_ASN.

bool CPKIFTimeStampRequest::ExtensionsPresent (  )  const

Interface: External

This function returns true if a decoded TimeStampRequest contained extensions. PKIF does not currently support processing or generating extensions in timestamp-related objects.

Return values:
True if a decoded TimeStampRequest contained extensions
False if a decoded TimeStampRequest did not contain extensions

Definition at line 405 of file TimeStampRequest.cpp.

References LOG_STRING_DEBUG, and TOOLKIT_TSP_ASN.

template<class T>
boost::shared_ptr<T> CPKIFTimeStampRequest::GetExtension (  )  [inline]

this function should be used to retrieve extensions in a type-safe manner you pass a type as a param and the function returns a default smart pointer to that type Interface: External

This function is used to retrieve an extension from an IPKIFHasExtensions object. It takes the type of extension sought by an application as a template parameter and returns a smart pointer to that type (containing a NULL pointer if the extension was not found).

Returns:
A smart pointer to the appropriate extension

Reimplemented from IPKIFHasExtensions.

CPKIFBufferPtr CPKIFTimeStampRequest::Encode (  )  const

Interface: External

This function is used to generate an encoded a timestamp request. If auto-nonce generation is enabled, a randomly generated nonce value will be included in the request. This function may generate an exception containing the following error code TSP_MISSING_REQUIRED_FIELD.

Returns:
A buffer that contains the encoded TimeStampRequest
Exceptions:
CPKIFTSPException(TSP_MISSING_REQUIRED_FIELD) 
CPKIFTSPException(COMMON_NOT_IMPLEMENTED) 

Definition at line 591 of file TimeStampRequest.cpp.

References CACASNWRAPPER_CREATE, COMMON_NOT_IMPLEMENTED, ConvertStringToASN1OBJID(), CopyOID(), g_nullParams, GetMessageImprint(), GetNonce(), GetPolicy(), LOG_STRING_DEBUG, PKIFTSPMemoryHelper::pRequest, TOOLKIT_TSP, and TOOLKIT_TSP_ASN.

void CPKIFTimeStampRequest::Decode ( CPKIFBufferPtr &  msg  ) 

Interface: External

This function is used to decode an encoded timestamp request.

Returns:
None
Exceptions:
CPKIFTSPException(COMMON_INVALID_INPUT) 
CPKIFTSPException(MSG_DECODE_FAILED) 
Parameters:
msg  [in] Reference to a smart pointer to a CPKIFBuffer object containing a TimeStampRequest to decode

Definition at line 689 of file TimeStampRequest.cpp.

References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, MSG_DECODE_FAILED, and TOOLKIT_TSP_ASN.

void CPKIFTimeStampRequest::GetExtensionByOID ( const CPKIFOID oid,
CPKIFX509ExtensionPtr &  ref 
) [virtual]

Interface: External

This function retrives the extension identified by CPKIFOID object

Returns:
None
Parameters:
oid  [in] Identifies the extension sought
ref  [out] The extension (if present).

Implements IPKIFHasExtensions.

Definition at line 258 of file TimeStampRequest.cpp.

void CPKIFTimeStampRequest::GetEncodedExtensions ( CPKIFBufferPtr &  buf  )  [virtual]

Interface: External

This function returns a smart pointer to CPKIFBuffer object which will contain the encoded extensions

Returns:
A smart pointer to CPKIFBuffer object which will contain the encoded extensions
Parameters:
buf  [out] A reference to a smart pointer to CPKIFBuffer object which will contain the encoded extensions

Implements IPKIFHasExtensions.

Definition at line 725 of file TimeStampRequest.cpp.

References CACASNWRAPPER_CREATE, and data.


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

Generated on Mon Nov 15 11:20:47 2010 for PublicKeyInfrastructureFramework(PKIF) by  doxygen 1.5.6