CPKIFSignerInfo Class Reference

#include <SignerInfo.h>

Inheritance diagram for CPKIFSignerInfo:

Inheritance graph
[legend]
Collaboration diagram for CPKIFSignerInfo:

Collaboration graph
[legend]

List of all members.


Detailed Description

The CPKIFSignerInfo class provides an interface to CMS SignerInfo objects. Applications create instances of CPKIFSignerInfo when generating digitally signed CMS SignedData messages. Application may review details of signer information via instances of CPKIFSignerInfo created by decoding a SignedData message into an instance of CPKIFSignedData.

To generate a digital signature within SignedData message, applications must create an instance of CPKIFSignerInfo to identify the credential that should be used to generate a signature. Applications need only call SetCredential when creating a SignerInfo object for purposes of generating a digital signature.

When verifying a digital signature within a SignedData message, application can review details of any particular signer by inspecting an instance of this class. Applications need not invoke SetCredential (or GetCredential) when inspecting a SignerInfo object retrieved from a SignedData message.

TSP-enforcing: No

Definition at line 39 of file SignerInfo.h.


Public Types

enum  SignerIdentifierChoice { ISSUERANDSERIAL, SKID, UNSET }

Public Member Functions

 CPKIFSignerInfo ()
 CPKIFSignerInfo (const CPKIFBufferPtr &siBuf)
virtual ~CPKIFSignerInfo ()
void SetCredential (CPKIFCredentialPtr &cred, bool enforceKeyUsage=true)
CPKIFCredentialPtr GetCredential () const
bool Decoded () const
unsigned int Version ()
SignerIdentifierChoice GetSignerIdentifierChoice () const
void SetIssuerAndSerialNumber (CPKIFIssuerAndSerialNumberPtr &iasn)
CPKIFIssuerAndSerialNumberPtr GetIssuerAndSerialNumber () const
void SetSKID (CPKIFBufferPtr &skid)
CPKIFBufferPtr GetSKID () const
CPKIFAlgorithmIdentifierPtr GetDigestAlg () const
void SetDigestAlg (CPKIFAlgorithmIdentifierPtr &digAlg)
void GetSignedAttributes (CPKIFAttributeList &sal)
void AddSignedAttribute (CPKIFAttributePtr &sa)
template<class T>
boost::shared_ptr< T > GetSignedAttribute ()
CPKIFAlgorithmIdentifierPtr GetSignatureAlgorithm () const
CPKIFBufferPtr GetSignature () const
void GetUnsignedAttributes (CPKIFAttributeList &ual)
void AddUnsignedAttribute (CPKIFAttributePtr &ua)
void GetEncodedSignedAttributes (CPKIFBufferPtr &buf)
void GetEncodedUnsignedAttributes (CPKIFBufferPtr &buf)
template<class T>
boost::shared_ptr< T > GetUnsignedAttribute ()
void _GetSignedAttributes (std::vector< CPKIFAttributePtr > &attrVector)
void _GetUnsignedAttributes (std::vector< CPKIFAttributePtr > &attrVector)
virtual void GetAddedSignedAttributes (std::vector< CPKIFAttributePtr > &attr)
virtual void GetAddedUnsignedAttributes (std::vector< CPKIFAttributePtr > &attr)

Member Enumeration Documentation

Enumerator:
ISSUERANDSERIAL 
SKID 
UNSET 

Definition at line 58 of file SignerInfo.h.


Constructor & Destructor Documentation

CPKIFSignerInfo::CPKIFSignerInfo (  ) 

Interface: External

Default constructor. Applications only use the default constructor when creating CPKIFSignerInfo objects.

Returns:
None

Definition at line 65 of file SignerInfo.cpp.

References g_sha1AI.

CPKIFSignerInfo::CPKIFSignerInfo ( const CPKIFBufferPtr &  siBuf  ) 

Interface: External

This constructor is invoked internally when parsing a CMS SignedData message (it is not invoked by applications); this version will throw a std::bad_alloc exception if allocation of memory to hold the encoded attribute value fails and an exception indicating ASN.1 decoding errors if any SignerInfo component fails to parse.

Returns:
None
Parameters:
siBuf  [in] Reference to a CACCMSSignerInfo structure containing information to use to populate a new instance of CPKIFSignerInfo

Definition at line 83 of file SignerInfo.cpp.

References CACASNWRAPPER_CREATE, and data.

CPKIFSignerInfo::~CPKIFSignerInfo (  )  [virtual]

Interface: External

This function destroys an instance of CPKIFSignerInfo object.

Returns:
None

Definition at line 319 of file SignerInfo.cpp.


Member Function Documentation

void CPKIFSignerInfo::SetCredential ( CPKIFCredentialPtr &  cred,
bool  enforceKeyUsage = true 
)

Interface: External

The SetCredential function is used to specify the credential that should be used to generate a digital signature. See the Creating Signed Messages sample. This function will throw an exception indicating COMMON_INVALID_INPUT if cred parameter is NULL. An exception indicating MSG_INVALID_CREDENTIAL will be thrown if certificate contained in cred is NULL.

Returns:
None
Exceptions:
CPKIFMessageException(MSG_INVALID_CREDENTIAL) 
CPKIFMessageException(COMMON_INVALID_INPUT) 
Parameters:
cred  [in] Reference to a CPKIFCredential object containing the credential to use when generating a digital signature

Definition at line 528 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, MSG_INVALID_CREDENTIAL, and TOOLKIT_MESSAGE_ASN.

CPKIFCredentialPtr CPKIFSignerInfo::GetCredential (  )  const

Interface: External

GetCredential returns a reference counted smart pointer to a CPKIFCredential object. The object may contain a NULL pointer if a valid credential has not been specified via a call to SetCredential.

The GetCredential function is used to retrieve credential objects specified by a call to SetCredential.

Returns:
None
Exceptions:
CPKIFMessageException(MSG_INVALID_CREDENTIAL) 
CPKIFMessageException(COMMON_INVALID_INPUT) 

Definition at line 383 of file SignerInfo.cpp.

bool CPKIFSignerInfo::Decoded (  )  const

Interface: External

Whether a SignerInfo object has been decoded from an encoded SignerInfo or has been constructed. This function is not typically used by applications.

Return values:
True if SignerInfo object has been decoded from an encoded SignerInfo
False SignerInfo object has been constructed

Definition at line 334 of file SignerInfo.cpp.

unsigned int CPKIFSignerInfo::Version (  ) 

Interface: External

This function is used to get CMS version of the SignersInfo object.

Returns:
This function returns the CMS version of the SignerInfo object. CACCMSCMSVersion is a typedef of CACCMSCMSVersion_Root structure

Definition at line 394 of file SignerInfo.cpp.

CPKIFSignerInfo::SignerIdentifierChoice CPKIFSignerInfo::GetSignerIdentifierChoice (  )  const

Interface: External

This function returns an indication of the type of signer identifier held by a SignerInfo object, either ISSUERANDSERIAL or SKID.

The SignerIdentifierChoice enum is used to identify signer identifier choice.

enum SignerIdentifierChoice {

ISSUERANDSERIAL, SKID, UNSET };

Returns:
An indication of the type of signer identifier held by a SignerInfo object

Definition at line 357 of file SignerInfo.cpp.

References GetIssuerAndSerialNumber(), GetSKID(), ISSUERANDSERIAL, SKID, and UNSET.

void CPKIFSignerInfo::SetIssuerAndSerialNumber ( CPKIFIssuerAndSerialNumberPtr &  iasn  ) 

Interface: External

This function is used to set the issuer name and serial number associated with a SignerInfo object. It should be used when GetSignerIdentifierChoice returns ISSUERANDSERIAL.

Returns:
None
Exceptions:
CPKIFMessageException(COMMON_INVALID_INPUT) 
Parameters:
iasn  [in] Reference to a smart pointer to a CPKIFIssuerAndSerialNumber object containing the issuer and serial number to use to identify the signer

Definition at line 462 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.

CPKIFIssuerAndSerialNumberPtr CPKIFSignerInfo::GetIssuerAndSerialNumber (  )  const

Interface: External

This function is used to get the issuer name and serial number associated with a SignerInfo object. It should be used when GetSignerIdentifierChoice returns ISSUERANDSERIAL.

Returns:
A smart pointer to CPKIFIssuerAndSerialNumber object

Definition at line 481 of file SignerInfo.cpp.

Referenced by GetSignerIdentifierChoice().

void CPKIFSignerInfo::SetSKID ( CPKIFBufferPtr &  skid  ) 

Interface: External

This function is used to set the key identifier associated with a SignerInfo object. It should be used when GetSignerIdentifierChoice returns SKID.

Returns:
None
Exceptions:
CPKIFMessageException(COMMON_INVALID_INPUT) 

Definition at line 495 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.

CPKIFBufferPtr CPKIFSignerInfo::GetSKID (  )  const

Interface: External

This function is used to get the key identifier associated with a SignerInfo object. It should be used when GetSignerIdentifierChoice returns SKID.

Returns:
A smart pointer to CPKIFBuffer object

Definition at line 511 of file SignerInfo.cpp.

Referenced by GetSignerIdentifierChoice().

CPKIFAlgorithmIdentifierPtr CPKIFSignerInfo::GetDigestAlg (  )  const

Interface: External

This function is used to get the hash algorithm associated with a SignerInfo object.

Returns:
None

Definition at line 429 of file SignerInfo.cpp.

void CPKIFSignerInfo::SetDigestAlg ( CPKIFAlgorithmIdentifierPtr &  digAlg  ) 

Interface: External

This function is used to set the hash algorithm associated with a SignerInfo object.

Returns:
None
Exceptions:
CPKIFMessageException(COMMON_INVALID_INPUT) 
Parameters:
digAlg  [in] Reference to a smart pointer to a CPKIFAlgorithmIdentifier object identifying the hash algorithm to set

Definition at line 442 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.

void CPKIFSignerInfo::GetSignedAttributes ( CPKIFAttributeList sal  ) 

Interface: External

This functions are used to get the signed attributes associated with a SignerInfo object.

Returns:
None
Parameters:
sal  [out] A list of the signed attributes.

Definition at line 572 of file SignerInfo.cpp.

References CPKIFCMSAttributeMediator2::GetInstance(), and IPKIFHasAttributes::GetSignedAttributes().

void CPKIFSignerInfo::AddSignedAttribute ( CPKIFAttributePtr &  sa  ) 

Interface: External

This functions are used to add the signed attributes associated with a SignerInfo object.

Returns:
None
Exceptions:
CPKIFMessageException(COMMON_INVALID_INPUT) 

Definition at line 613 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.

template<class T>
boost::shared_ptr< T > CPKIFSignerInfo::GetSignedAttribute (  )  [inline]

Interface: External

This function is used to get the signed attributes associated with a SignerInfo object.

Returns:
A smart pointer to the appropriate signed attribute

Definition at line 161 of file SignerInfo.h.

References _GetSignedAttributes().

CPKIFAlgorithmIdentifierPtr CPKIFSignerInfo::GetSignatureAlgorithm (  )  const

Interface: External

This function returns a smart pointer to a CPKIFAlgorithmIdentifier object containing the signature algorithm associated with a SignerInfo object.

Returns:
A smart pointer to a CPKIFAlgorithmIdentifier object

Definition at line 406 of file SignerInfo.cpp.

CPKIFBufferPtr CPKIFSignerInfo::GetSignature (  )  const

Interface: External

This function returns a smart pointer to a CPKIFBuffer object containing the signature associated with a SignerInfo object or NULL, if no signature is present.

Returns:
A smart pointer to a CPKIFBuffer object

Definition at line 418 of file SignerInfo.cpp.

void CPKIFSignerInfo::GetUnsignedAttributes ( CPKIFAttributeList ual  ) 

Interface: External

This functions are used to get the unsigned attributes associated with a SignerInfo object.

Returns:
None
Parameters:
ual  [out] A list of the unsigned attributes.

Definition at line 554 of file SignerInfo.cpp.

References CPKIFCMSAttributeMediator2::GetInstance(), and IPKIFHasAttributes::GetUnsignedAttributes().

void CPKIFSignerInfo::AddUnsignedAttribute ( CPKIFAttributePtr &  ua  ) 

Interface: External

This functions are used to add the unsigned attributes associated with a SignerInfo object.

Returns:
None
Exceptions:
CPKIFMessageException(COMMON_INVALID_INPUT) 
Parameters:
ua  [in] An attribute to add to the unsigned attributes.

Definition at line 594 of file SignerInfo.cpp.

References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.

void CPKIFSignerInfo::GetEncodedSignedAttributes ( CPKIFBufferPtr &  buf  )  [virtual]

Interface: External

This constructor is invoked internally when parsing a CMS SignedData message (it is not invoked by applications); this version will throw a std::bad_alloc exception if allocation of memory to hold the encoded attribute value fails and an exception indicating ASN.1 decoding errors if any SignerInfo component fails to parse.

Returns:
None Interface: External
This function retrives a list of DER encoded signed CMS attributes

Returns:
None
Parameters:
buf  [out] A reference to a smart pointer to CPKIFBuffer object containing the DER encoded list of CMS attributes

Reimplemented from IPKIFHasAttributes.

Definition at line 278 of file SignerInfo.cpp.

void CPKIFSignerInfo::GetEncodedUnsignedAttributes ( CPKIFBufferPtr &  buf  )  [virtual]

Interface: External

This function retrives a list of DER unsigned signed CMS attributes

Returns:
None
Parameters:
buf  [out] A reference to a smart pointer to CPKIFBuffer object containing the DER encoded list of CMS attributes

Reimplemented from IPKIFHasAttributes.

Definition at line 298 of file SignerInfo.cpp.

template<class T>
boost::shared_ptr< T > CPKIFSignerInfo::GetUnsignedAttribute (  )  [inline]

Interface: External

This function is used to get the unsigned attributes associated with a SignerInfo object.

Returns:
None

Definition at line 123 of file SignerInfo.h.

References _GetUnsignedAttributes().

void CPKIFSignerInfo::_GetSignedAttributes ( std::vector< CPKIFAttributePtr > &  attrVector  ) 

Interface: Subsystem

This functions are used to get the signed attributes associated with a SignerInfo object.

Returns:
None
Parameters:
attrVector  [out] A vector of CPKIFAttribute objects

Definition at line 702 of file SignerInfo.cpp.

References CPKIFCMSAttributeMediator2::GetInstance(), and IPKIFHasAttributes::GetSignedAttributes().

Referenced by GetSignedAttribute().

void CPKIFSignerInfo::_GetUnsignedAttributes ( std::vector< CPKIFAttributePtr > &  attrVector  ) 

Interface: External

This functions are used to get the unsigned attributes associated with a SignerInfo object.

Returns:
None
Parameters:
attrVector  [out] A vector of CPKIFAttribute objects

Definition at line 716 of file SignerInfo.cpp.

References CPKIFCMSAttributeMediator2::GetInstance(), and IPKIFHasAttributes::GetUnsignedAttributes().

Referenced by GetUnsignedAttribute().

void CPKIFSignerInfo::GetAddedSignedAttributes ( std::vector< CPKIFAttributePtr > &  attr  )  [virtual]

Interface: External

This functions are used to get the added signed attributes associated with a SignerInfo object.

Returns:
None
Parameters:
attr  [out] A vector of CPKIFAttribute objects

Reimplemented from IPKIFHasAttributes.

Definition at line 730 of file SignerInfo.cpp.

void CPKIFSignerInfo::GetAddedUnsignedAttributes ( std::vector< CPKIFAttributePtr > &  attr  )  [virtual]

Interface: External

This functions are used to get the added unsigned attributes associated with a SignerInfo object.

Returns:
None
Parameters:
attr  [out] A vector of CPKIFAttribute objects

Reimplemented from IPKIFHasAttributes.

Definition at line 748 of file SignerInfo.cpp.


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

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