Functions
- bool CryptPlug::findCertificates (const char *addressee, char **certificates, int *newSize, bool secretOnly, char **attrOrder, const char *unknownAttrsHandling)
- bool CryptPlug::encryptMessage (const char *cleartext, const char **ciphertext, const size_t *cipherLen, const char *addressee, struct StructuringInfo *structuring, int *errId, char **errTxt)
- bool CryptPlug::encryptAndSignMessage (const char *cleartext, const char **ciphertext, const char *certificate, struct StructuringInfo *structuring)
- bool CryptPlug::decryptMessage (const char *ciphertext, bool cipherIsBinary, int cipherLen, const char **cleartext, const char *certificate, int *errId, char **errTxt)
- bool CryptPlug::decryptAndCheckMessage (const char *ciphertext, bool cipherIsBinary, int cipherLen, const char **cleartext, const char *certificate, bool *signatureFound, struct SignatureMetaData *sigmeta, int *errId, char **errTxt, char **attrOrder, const char *unknownAttrsHandling)
- bool CryptPlugWrapper::findCertificates (const char *addressee, char **certificates, int *newSize, bool secretOnly)
- bool CryptPlugWrapper::encryptMessage (const char *cleartext, const char **ciphertext, const size_t *cipherLen, const char *addressee, StructuringInfoWrapper &structuring, int *errId, char **errTxt)
- bool CryptPlugWrapper::encryptAndSignMessage (const char *cleartext, const char **ciphertext, const char *certificate, StructuringInfoWrapper &structuring)
- bool CryptPlugWrapper::decryptMessage (const char *ciphertext, bool cipherIsBinary, int cipherLen, char **cleartext, const char *certificate, int *errId, char **errTxt)
- bool CryptPlugWrapper::decryptAndCheckMessage (const char *ciphertext, bool cipherIsBinary, int cipherLen, char **cleartext, const char *certificate, bool *signatureFound, CryptPlug::SignatureMetaData *sigmeta, int *errId, char **errTxt)
Detailed Description
The following methods are used to encrypt and decrypt email messages.
Function Documentation
bool CryptPlug::findCertificates |
( |
const char * |
addressee, |
|
|
char ** |
certificates, |
|
|
int * |
newSize, |
|
|
bool |
secretOnly, |
|
|
char ** |
attrOrder, |
|
|
const char * |
unknownAttrsHandling |
|
) |
[inherited] |
|
|
Find all certificate for a given addressee.
NOTE: The certificate parameter must point to a not-yet allocated char*. The function will allocate the memory needed and return the size in newSize. If secretOnly is true, only secret keys are returned. |
bool CryptPlug::encryptMessage |
( |
const char * |
cleartext, |
|
|
const char ** |
ciphertext, |
|
|
const size_t * |
cipherLen, |
|
|
const char * |
addressee, |
|
|
struct StructuringInfo * |
structuring, |
|
|
int * |
errId, |
|
|
char ** |
errTxt |
|
) |
[inherited] |
|
|
Encrypts an email message in cleartext according to the addressee and the current settings (algorithm, etc.) and returns the encoded data bloc in *ciphertext . The length returned in *cipherLen tells you the size (==amount of bytes) of the ciphertext, if the structuring information would return with contentTEncCode set to "base64" the ciphertext might contain a char 0x00 and has to be converted into base64 before sending.
If the message could be encrypted, the function returns true , otherwise false .
Use the StructuringInfo data returned in parameter structuring to find out how to build the respective MIME object (or the plain text message body, resp.).
- Note:
- The function allocates memory for the
*ciphertext , so make sure you set free that memory when no longer needing it (as shown in example code provided with documentation of the struct StructuringInfo ).
The function also allocates memory for some char* members of the StructuringInfo* parameter that you are providing, therefore you must call the free_StructuringInfo() function to make sure all memory is set free that was allocated. This must be done before calling the next cryptography function!
- See also:
- StructuringInfo, free_StructuringInfo
|
bool CryptPlug::encryptAndSignMessage |
( |
const char * |
cleartext, |
|
|
const char ** |
ciphertext, |
|
|
const char * |
certificate, |
|
|
struct StructuringInfo * |
structuring |
|
) |
[inherited] |
|
|
Combines the functionality of encryptMessage() and signMessage() .
If certificate is NULL , the default certificate will be used.
If the message could be signed and encrypted, the function returns true , otherwise false .
Use the StructuringInfo data returned in parameter structuring to find out how to build the respective MIME object (or the plain text message body, resp.).
- Note:
- The function allocates memory for the
*ciphertext , so make sure you set free that memory when no longer needing it (as shown in example code provided with documentation of the struct StructuringInfo ).
The function also allocates memory for some char* members of the StructuringInfo* parameter that you are providing, therefore you must call the free_StructuringInfo() function to make sure all memory is set free that was allocated. This must be done before calling the next cryptography function!
- See also:
- StructuringInfo, free_StructuringInfo
|
bool CryptPlug::decryptMessage |
( |
const char * |
ciphertext, |
|
|
bool |
cipherIsBinary, |
|
|
int |
cipherLen, |
|
|
const char ** |
cleartext, |
|
|
const char * |
certificate, |
|
|
int * |
errId, |
|
|
char ** |
errTxt |
|
) |
[inherited] |
|
|
Tries to decrypt an email message ciphertext and returns the decrypted message in cleartext .
The certificate is used for decryption. If the message could be decrypted, the function returns true , otherwise false . |
bool CryptPlug::decryptAndCheckMessage |
( |
const char * |
ciphertext, |
|
|
bool |
cipherIsBinary, |
|
|
int |
cipherLen, |
|
|
const char ** |
cleartext, |
|
|
const char * |
certificate, |
|
|
bool * |
signatureFound, |
|
|
struct SignatureMetaData * |
sigmeta, |
|
|
int * |
errId, |
|
|
char ** |
errTxt, |
|
|
char ** |
attrOrder, |
|
|
const char * |
unknownAttrsHandling |
|
) |
[inherited] |
|
|
Combines the functionality of checkMessageSignature() and decryptMessage() .
If certificate is NULL , the default certificate will be used. If sigmeta is non-null, the SignatureMetaData object pointed to will contain meta information about the signature after the function call. |
bool CryptPlugWrapper::findCertificates |
( |
const char * |
addressee, |
|
|
char ** |
certificates, |
|
|
int * |
newSize, |
|
|
bool |
secretOnly |
|
) |
[inherited] |
|
|
Find all certificate for a given addressee.
NOTE: The certificate parameter must point to a not-yet allocated char*. The function will allocate the memory needed and return the size in newSize. If secretOnly is true, only secret keys are returned. |
bool CryptPlugWrapper::encryptMessage |
( |
const char * |
cleartext, |
|
|
const char ** |
ciphertext, |
|
|
const size_t * |
cipherLen, |
|
|
const char * |
addressee, |
|
|
StructuringInfoWrapper & |
structuring, |
|
|
int * |
errId, |
|
|
char ** |
errTxt |
|
) |
[inherited] |
|
|
Encrypts an email message in cleartext according to the addressee and the current settings (algorithm, etc.) and returns the encoded data bloc in *ciphertext . The length returned in *cipherLen tells you the size (==amount of bytes) of the ciphertext, if the structuring information would return with contentTEncCode set to "base64" the ciphertext might contain a char 0x00 and has to be converted into base64 before sending.
If the message could be encrypted, the function returns true , otherwise false .
Use the StructuringInfoWrapper data returned in parameter structuring to find out how to build the respective MIME object (or the plain text message body, resp.).
- Note:
- The function allocates memory for the
*ciphertext , so make sure you set free that memory when no longer needing it (as shown in example code provided with documentation of the class StructuringInfoWrapper ).
The function also does not use a pure StructuringInfo* struct parameter (as defined in cryptplug.h) but a convenient StructuringInfoWrapper& class parameter. Therefore you must not call the free_StructuringInfo() function: all memory that will be occupied for structuring info by the signing function will be freed automatically by the StructuringInfoWrapper's destructor.
- See also:
- StructuringInfoWrapper
|
bool CryptPlugWrapper::encryptAndSignMessage |
( |
const char * |
cleartext, |
|
|
const char ** |
ciphertext, |
|
|
const char * |
certificate, |
|
|
StructuringInfoWrapper & |
structuring |
|
) |
[inherited] |
|
|
Combines the functionality of encryptMessage() and signMessage() .
If certificate is NULL , the default certificate will be used.
If the message could be signed and encrypted, the function returns true , otherwise false .
Use the StructuringInfoWrapper data returned in parameter structuring to find out how to build the respective MIME object (or the plain text message body, resp.).
- Note:
- The function allocates memory for the
*ciphertext , so make sure you set free that memory when no longer needing it (as shown in example code provided with documentation of the class StructuringInfoWrapper ).
The function also does not use a pure StructuringInfo* struct parameter (as defined in cryptplug.h) but a convenient StructuringInfoWrapper& class parameter. Therefore you must not call the free_StructuringInfo() function: all memory that will be occupied for structuring info by the signing function will be freed automatically by the StructuringInfoWrapper's destructor.
- See also:
- StructuringInfoWrapper
|
bool CryptPlugWrapper::decryptMessage |
( |
const char * |
ciphertext, |
|
|
bool |
cipherIsBinary, |
|
|
int |
cipherLen, |
|
|
char ** |
cleartext, |
|
|
const char * |
certificate, |
|
|
int * |
errId, |
|
|
char ** |
errTxt |
|
) |
[inherited] |
|
|
Tries to decrypt an email message ciphertext and returns the decrypted message in cleartext .
The certificate is used for decryption. If the message could be decrypted, the function returns true , otherwise false . |
bool CryptPlugWrapper::decryptAndCheckMessage |
( |
const char * |
ciphertext, |
|
|
bool |
cipherIsBinary, |
|
|
int |
cipherLen, |
|
|
char ** |
cleartext, |
|
|
const char * |
certificate, |
|
|
bool * |
signatureFound, |
|
|
CryptPlug::SignatureMetaData * |
sigmeta, |
|
|
int * |
errId, |
|
|
char ** |
errTxt |
|
) |
[inherited] |
|
|
Combines the functionality of checkMessageSignature() and decryptMessage() .
If certificate is NULL , the default certificate will be used. If sigmeta is non-null, the SignatureMetaData object pointed to will contain meta information about the signature after the function call. |