#include <EncryptedData.h>
When creating or decrypting an EncryptedData object, the IPKIFCryptoRawOperations interfaces must be available. For encryption operations requiring generation of a random initialization vector, access to the IPKIFCryptoMisc interface is also required.
TSP-enforcing: No
Definition at line 33 of file EncryptedData.h.
Public Types | |
enum | CMSVersion { CMSv0 = 0, CMSv2 = 2 } |
Public Member Functions | |
CPKIFEncryptedData () | |
virtual | ~CPKIFEncryptedData () |
CMSVersion | GetVersion () const |
void | SetDataToEncrypt (CPKIFEncryptedContentInfoPtr &buf) |
CPKIFEncryptedContentInfoPtr | GetEncryptedData () const |
void | AddUnprotectedAttribute (CPKIFAttributePtr &attr) |
void | GetUnprotectedAttributes (CPKIFAttributeList &ual) |
void | GetEncodedUnprotectedAttributes (CPKIFBufferPtr &buf) |
void | _GetUnprotectedAttributes (std::vector< CPKIFAttributePtr > attrVector) |
template<class T> | |
boost::shared_ptr< T > | GetUnprotectedAttribute () |
void | ClearContent (bool removeMediatorAssociations=true) |
void | SetKeyMaterial (CPKIFKeyMaterialPtr &key) |
CPKIFBufferPtr | Encode () |
void | Decode (CPKIFBufferPtr &buf) |
CPKIFBufferPtr | Decrypt () |
void | GetAddedUnprotectedAttributes (std::vector< CPKIFAttributePtr > &attr) |
void | AddMediator (IPKIFMediatorPtr &m) |
IPKIFMediatorPtr | GetMediator () |
Friends | |
struct | CPKIFEncryptedDataImpl |
CPKIFEncryptedData::CPKIFEncryptedData | ( | ) |
Interface: External
This function creates and initializes an instance of CPKIFEncryptedData. The version property is initialized to CMSv0.
Definition at line 103 of file EncryptedData.cpp.
References CMSv0, g_encryptedData, LOG_STRING_DEBUG, CPKIFContentType::SetContentType(), and TOOLKIT_CRYPTO_MISC.
CPKIFEncryptedData::~CPKIFEncryptedData | ( | ) | [virtual] |
Interface: External
This function destroys an instance of CPKIFEncryptedData object.
Definition at line 123 of file EncryptedData.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_MISC.
CPKIFEncryptedData::CMSVersion CPKIFEncryptedData::GetVersion | ( | ) | const |
Interface: External
This function returns the version of the EncryptedData object.
typedef enum {
CMSv0 = 0, CMSv2 = 2,
} CMSVersion;
Definition at line 226 of file EncryptedData.cpp.
void CPKIFEncryptedData::SetDataToEncrypt | ( | CPKIFEncryptedContentInfoPtr & | buf | ) |
Interface: External
This function is used to specify the data to encrypt as part of an EncryptData object.
CPKIFMessageException(COMMON_INVALID_INPUT) |
buf | [in] Reference to a CPKIFEncryptedContentInfo object containing the data to encrypt |
Definition at line 239 of file EncryptedData.cpp.
References COMMON_INVALID_INPUT, LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_MISC.
CPKIFEncryptedContentInfoPtr CPKIFEncryptedData::GetEncryptedData | ( | ) | const |
Interface: External
This function retreives the encrypted content from EncryptedData
Definition at line 896 of file EncryptedData.cpp.
References m_impl.
void CPKIFEncryptedData::AddUnprotectedAttribute | ( | CPKIFAttributePtr & | attr | ) |
Interface: External
This function is used to add a CMS attribute to the collection of unprotected attributed associated with a CPKIFEncryptedData object. If this function is invoked with an attr parameter that contains a NULL pointer, a CPKIFMessageException with the error code set to COMMON_INVALID_INPUT will be thrown.
CPKIFMessageException(COMMON_INVALID_INPUT) |
attr | [in] Reference to a smart pointer to a CPKIFAttribute object containing the CMS attribute to add to the collection of unprotected attributes associated with a CPKIFEncryptedData object |
Definition at line 270 of file EncryptedData.cpp.
References COMMON_INVALID_INPUT, GetUnprotectedAttributes(), LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_MISC.
void CPKIFEncryptedData::GetUnprotectedAttributes | ( | CPKIFAttributeList & | ual | ) |
Interface: External
This function adds the attributes from the unprotected attributes collection associated with an EncryptedData object to the list passed via the ual parameter.
ual | [in] Reference to a CPKIFAttributeList to receive the unprotected attributes |
Definition at line 300 of file EncryptedData.cpp.
References LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_MISC.
Referenced by AddUnprotectedAttribute(), and Encode().
void CPKIFEncryptedData::GetEncodedUnprotectedAttributes | ( | CPKIFBufferPtr & | buf | ) | [virtual] |
Interface: External
This function retreives a list of DER encoded unprotected CMS attributes.
buf | [out] A reference to a smart pointer to CPKIFBuffer containing the list of CMS attributes |
Reimplemented from IPKIFHasAttributes.
Definition at line 834 of file EncryptedData.cpp.
References CACASNWRAPPER_CREATE, and data.
void CPKIFEncryptedData::_GetUnprotectedAttributes | ( | std::vector< CPKIFAttributePtr > | attrVector | ) |
Interface: Subsystem
This function retrieves a list of unprotected CMS attributes.
attrVector | [out] Vector of CPKIFAttribute obejcts |
Definition at line 864 of file EncryptedData.cpp.
References CPKIFCMSAttributeMediator2::GetInstance(), and IPKIFHasAttributes::GetUnprotectedAttributes().
Referenced by GetUnprotectedAttribute().
boost::shared_ptr< T > CPKIFEncryptedData::GetUnprotectedAttribute | ( | ) | [inline] |
Interface: External
This function is used to retrieve all attributes from the set of unprotected attributes included in an EnvelopedData.
Definition at line 131 of file EncryptedData.h.
References _GetUnprotectedAttributes().
void CPKIFEncryptedData::ClearContent | ( | bool | removeMediatorAssociations = true |
) |
Interface: External
This function resets the state of a CPKIFEncryptedData object. The version property is set to CMSv0. The unprotected attributes list is emptied. The key and data properties are set to NULL. If the removeMediatorAssociations parameter is set to true, then the base class RemoveMediatorAssociations function is invoked to disassociate the instance of CPKIFEncryptedData from the mediators added via AddMediator.
removeMediatorAssociations | [in] Boolean value that indicates mediators associated with an instance of CPKIFEncryptedData should be removed |
Definition at line 325 of file EncryptedData.cpp.
References CMSv0, LOG_STRING_DEBUG, and TOOLKIT_CRYPTO_MISC.
void CPKIFEncryptedData::SetKeyMaterial | ( | CPKIFKeyMaterialPtr & | key | ) |
Interface: External
This function is used to specify the key material (and algorithm and mode) to use when encrypting the data.
key | [in] Reference to a CPKIFKeyMaterial object containing the key to use to encrypt the data |
Definition at line 204 of file EncryptedData.cpp.
CPKIFBufferPtr CPKIFEncryptedData::Encode | ( | ) | [virtual] |
Interface: External
This function encodes EncryptedDate object.
CPKIFMessageException(COMMON_INVALID_INPUT) |
Implements CPKIFContentType.
Definition at line 368 of file EncryptedData.cpp.
References CACASNWRAPPER_CREATE, COMMON_INVALID_INPUT, CopyOID(), GetUnprotectedAttributes(), LOG_STRING_DEBUG, PKIFCMSMessageMemoryHelper::pEncryptedData, SetupAttributesInObjectiveStructure(), and TOOLKIT_CRYPTO_MISC.
void CPKIFEncryptedData::Decode | ( | CPKIFBufferPtr & | buf | ) | [virtual] |
Interface: External
This function is used to decode an encoded encrypted data message, i.e. the content from a Content Info message with an encrypted data payload. This function does not decrypt the contents of the message. This function may generate an exception containing the following error code MSG_DECODE_FAILED.
CPKIFMessageException(MSG_DECODE_FAILED) | ||
CPKIFMessageException(COMMON_INVALID_INPUT) |
buf | [in] Reference to a smart pointer to a CPKIFBuffer object containing an encoded EncryptedData message to decode |
Implements CPKIFContentType.
Definition at line 465 of file EncryptedData.cpp.
References CMSv0, CMSv2, COMMON_INVALID_INPUT, LOG_STRING_DEBUG, MSG_DECODE_FAILED, PEMDecode(), CPKIFException::push_info(), and TOOLKIT_CRYPTO_MISC.
CPKIFBufferPtr CPKIFEncryptedData::Decrypt | ( | ) |
Interface: External
This function returns a smart pointer to a CPKIFBuffer object containing the decrypted data from an EncryptedData object. This function may generate an exception containing the following error code MSG_MISSING_PARAMS.
CPKIFMessageException(MSG_MISSING_PARAMS) | ||
CPKIFMessageException(ASN1_DECODE_ERROR) | ||
CPKIFMessageException(COMMON_INVALID_INPUT) | ||
CPKIFMessageException(COMMON_MEDIATOR_MISSING) |
Definition at line 550 of file EncryptedData.cpp.
References ASN1_DECODE_ERROR, COMMON_INVALID_INPUT, COMMON_MEDIATOR_MISSING, IPKIFCryptoRawOperations::Decrypt(), GetMediator(), LOG_STRING_DEBUG, ModeRequiresIV(), MSG_MISSING_PARAMS, TOOLKIT_CRYPTO_MISC, and TOOLKIT_MESSAGE_ASN.
void CPKIFEncryptedData::GetAddedUnprotectedAttributes | ( | std::vector< CPKIFAttributePtr > & | attr | ) | [virtual] |
Interface: External
This function retreives a list of added unprotected CMS attributes.
attr | [out] Vector of CPKIFAttribute obejcts |
Reimplemented from IPKIFHasAttributes.
Definition at line 878 of file EncryptedData.cpp.
void CPKIFEncryptedData::AddMediator | ( | IPKIFMediatorPtr & | m | ) |
Interface: External
This function added a mediator object to the CPKIFEncryptedData for purposes of obtaining pointers to desired interfaces.
m | [in] Smart Pointer to a mediator obejct |
Definition at line 142 of file EncryptedData.cpp.
IPKIFMediatorPtr CPKIFEncryptedData::GetMediator | ( | ) |
Interface: External
This function returns the Mediator object stored in CPKIFEncryptedData
Definition at line 155 of file EncryptedData.cpp.
Referenced by Decrypt().
friend struct CPKIFEncryptedDataImpl [friend] |
Definition at line 35 of file EncryptedData.h.