#include <SignerInfo.h>
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) |
CPKIFSignerInfo::CPKIFSignerInfo | ( | ) |
Interface: External
Default constructor. Applications only use the default constructor when creating CPKIFSignerInfo objects.
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.
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.
Definition at line 319 of file SignerInfo.cpp.
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.
CPKIFMessageException(MSG_INVALID_CREDENTIAL) | ||
CPKIFMessageException(COMMON_INVALID_INPUT) |
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.
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.
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.
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 };
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.
CPKIFMessageException(COMMON_INVALID_INPUT) |
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.
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.
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.
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.
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.
CPKIFMessageException(COMMON_INVALID_INPUT) |
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.
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.
CPKIFMessageException(COMMON_INVALID_INPUT) |
Definition at line 613 of file SignerInfo.cpp.
References COMMON_INVALID_INPUT, and TOOLKIT_MESSAGE.
boost::shared_ptr< T > CPKIFSignerInfo::GetSignedAttribute | ( | ) | [inline] |
Interface: External
This function is used to get the signed attributes associated with a SignerInfo object.
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.
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.
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.
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.
CPKIFMessageException(COMMON_INVALID_INPUT) |
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.
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
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.
boost::shared_ptr< T > CPKIFSignerInfo::GetUnsignedAttribute | ( | ) | [inline] |
Interface: External
This function is used to get the unsigned attributes associated with a SignerInfo object.
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.
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.
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.
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.
attr | [out] A vector of CPKIFAttribute objects |
Reimplemented from IPKIFHasAttributes.
Definition at line 748 of file SignerInfo.cpp.