certmanager/lib Library API Documentation

Encryption and Decryption
[Signing and Encrypting Actions]


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.

Definition at line 1551 of file cryptplug.cpp.

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

Definition at line 663 of file cryptplug.cpp.

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

Definition at line 859 of file cryptplug.cpp.

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.

Definition at line 912 of file cryptplug.cpp.

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.

Definition at line 1978 of file cryptplug.cpp.

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.

Definition at line 979 of file cryptplugwrapper.cpp.

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

Definition at line 996 of file cryptplugwrapper.cpp.

References StructuringInfoWrapper::data.

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

Definition at line 1009 of file cryptplugwrapper.cpp.

References StructuringInfoWrapper::data.

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.

Definition at line 1019 of file cryptplugwrapper.cpp.

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.

Definition at line 1032 of file cryptplugwrapper.cpp.

KDE Logo
This file is part of the documentation for certmanager/lib Library Version 3.3.2.
Documentation copyright © 1996-2004 the KDE developers.
Generated on Wed Mar 23 22:40:30 2005 by doxygen 1.3.9.1 written by Dimitri van Heesch, © 1997-2003