#include <digiSig.h>
Public Member Functions | |
int | Sign (const std::string &sPrivateKey, const std::string &sCommand, uint8_t *sig_buf, unsigned int &iSigLen) |
bool | Verify (const std::string &sPublicKey, const std::string &sCommand, const uint8_t *sig_buf, unsigned int iSigLen) |
bool | GetIssuerName (const std::string &sPublicKey, std::string &sIssuerName) |
bool | VerifyByCA (const std::string &sCert, const std::string &sFile) |
bool | GetSubjectName (const std::string &sPublicKey, std::string &sSubjectName) |
int | SignSMIME (const std::string &sCert, const std::string &sPrivateKey, const std::string &sCommandFile, const std::string &sOutFile, const std::string &sTo, const std::string &sFrom, const std::string &sSubject, bool bAddNoCert=false) |
int | VerifySMIME (const std::string &sFileToVerify, const std::string &sCAChain, const std::string &sDataFile, const std::string &sSignerCert=std::string()) |
int | ParseMIME (const std::string &sFile, ReqType req, std::string &sOut) |
int | GetAllIssuer (const std::string &sCert, std::set< std::string > &sIssuerSet) |
int | GetSenderCertificate (const std::string &sMsg, const std::string &sFileToSave) |
int | save_certs (const char *signerfile, STACK_OF(X509)*signers) |
void | print_file (const std::string &sFileName) |
Private Member Functions | |
bool | GetParam (const std::string &sPublicKey, std::string &sParamName, const ReqType eReq) |
int | GetParamsFromPKCS7 (const PKCS7 *p7, ReqType req, std::string &sOut) |
bool CDigiSig::GetIssuerName | ( | const std::string & | sPublicKey, | |
std::string & | sIssuerName | |||
) |
Extracts the issuer name from X509 certificate.
bool CDigiSig::GetSubjectName | ( | const std::string & | sPublicKey, | |
std::string & | sSubjectName | |||
) |
Extracts the Subject name from the SMIME file.
int CDigiSig::ParseMIME | ( | const std::string & | sFile, | |
ReqType | req, | |||
std::string & | sOut | |||
) |
Parse a SMIME file for different field such as TO, FROM, SUBJECT etc.
int CDigiSig::SignSMIME | ( | const std::string & | sCert, | |
const std::string & | sPrivateKey, | |||
const std::string & | sCommandFile, | |||
const std::string & | sOutFile, | |||
const std::string & | sTo, | |||
const std::string & | sFrom, | |||
const std::string & | sSubject, | |||
bool | bAddNoCert = false | |||
) |
Signs a given file sCommandFile with private key using SMIME format and output the signed file in sOutFile. Put sTo, sFrom and sSubject in the SMIME message. If bAddNoCert is false, then attach the sender's certificate sCert in the SMIME message.
bool CDigiSig::VerifyByCA | ( | const std::string & | sCert, | |
const std::string & | sFile | |||
) |
Verifies a given certificate sFile by a CA chain hierarchy as specified in sCert.
int CDigiSig::VerifySMIME | ( | const std::string & | sFileToVerify, | |
const std::string & | sCAChain, | |||
const std::string & | sDataFile, | |||
const std::string & | sSignerCert = std::string() | |||
) |
Verifies a given file sFileToVerify in SMIME format with the CA chain sCAChain. Extracts the data and write in sData file. Extracts the sender's certificate and write in sSignerCert file.