Rank: Member
Groups: Registered
Joined: 12/23/2010(UTC) Posts: 24 Location: rennes
Thanks: 8 times
Hello, With the CAPICOM SDK I m able to retrieve for a certificat Email and Serial number :ISignedDataPtr oSignedData = NULL; ISignerPtr oSigner = oSignedData->Signers->Item[1]; _bstr_t bstrMail=oSigner->Certificate->GetInfo(CAPICOM_CERT_INFO_SUBJECT_EMAIL_NAME); _bstr_t bstrSerial=oSigner->Certificate->SerialNumber; Is it possible to do the same with the EAGetMailObjLib::ICertificatePtr? Best regards, florent
Rank: Administration
Groups: Administrators
Joined: 11/11/2010(UTC) Posts: 1,153
Thanks: 9 times Was thanked: 55 time(s) in 55 post(s)
I am sorry it doesn't support this feature. I will add those features at next version.
However, you can implement it like this in your code:
include the following headers:
Code:
#include <Wincrypt.h>
#pragma comment( lib, "Crypt32.lib" )
Code:
//oCert is EAGetMailObjLib::ICertitificatePtr;
// get serial number
PCERT_CONTEXT pCertContext = (PCERT_CONTEXT)oCert->Handle;
int len = pCertContext->pCertInfo->SerialNumber.cbData;
TCHAR* pszSerial = new TCHAR[2*len+1];
pszSerial[2*len] = _T('\0');
TCHAR* pszBuf = pszSerial;
for( int i = len-1; i >= 0 ; i-- )
{
::_stprintf( pszBuf, _T("%02x"), pCertContext->pCertInfo->SerialNumber.pbData[i] );
pszBuf +=2;
}
//pszSerial is the serial number
// please use delete [] pszSerial to free the memory.
delete [] pszSerial;
// get email address;
DWORD dwOut = 0;
dwOut = ::CertGetNameString(
pCertContext,
CERT_NAME_EMAIL_TYPE,
0,
0,
NULL,
0 );
if( dwOut == 0 )
{
DWORD dwLastError = ::GetLastError();
return;
}
TCHAR* pszEmail = new TCHAR[dwOut+1];
pszEmail[dwOut] = _T('\0');
dwOut = ::CertGetNameString(
pCertContext,
CERT_NAME_EMAIL_TYPE,
0,
0,
pszEmail,
dwOut );
if( dwOut == 0 )
{
DWORD dwLastError = ::GetLastError();
delete []pszEmail;
return;
}
// please use delete [] szEmail to free the memory.
delete []pszEmail;
1 user thanked ivan for this useful post.
Forum Jump
EmailArchitect Support
Email Component Development
- EASendMail SMTP Component - .NET Version
- EASendMail SMTP Component - Windows Store Apps
- EASendMail SMTP ActiveX Object
- EAGetMail POP3 & IMAP4 Component - .NET Version
- EAGetMail POP3 & IMAP4 ActiveX Object
Exchange Server and IIS SMTP Plugin
- DomanKeys/DKIM for Exchange Server and IIS SMTP
- Disclaimer and S/MIME for Exchange Server and IIS
EmailArchitect Email Server
- EmailArchitect Email Server (General)
- EmailArchitect Email Server Development
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.