Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
platform
active.directory
adsi
adsi.iis-admin
base
com_ole
complus_mts
component_svcs
database
directx
gdi
graphics_mm
internet.client
internet.server
internet.server.isapi-dev
localization
mapi
messaging
msi
mslayerforunicode
multimedia
networking
networking.ipv6
sdk_install
security
shell
telephony.tapi_2
telephony.tapi_3
telephony.tsp
telephony.wte
tools
ui
ui_shell
win_base_svcs
win16
  
 
date: Fri, 11 Jan 2008 08:47:02 -0800,    group: microsoft.public.platformsdk.mapi        back       


PR_USER_X509_CERTIFICATE value and Outlook contacts certificate   
Hi,
I am trying to make a code that will import certificate file for contact 
using c++.
The think is i didnt found anithing on the net but with outlook spy and MFC 
mapi i conclude that PR_USER_X509_CERTIFICATE is the value where the 
certificate(s) should be stored. This is the part of the code i use to assign 
the certificate to a contact item in outlook:
{
#define PR_USER_X509_CERTIFICATE  PROP_TAG( PT_MV_BINARY, 0x3A70)
#define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
HCERTSTORE hSystemStore;
HCERTSTORE hFileStore;
PCCERT_CONTEXT pCertContext = NULL;
TCHAR pszNameString[256]; 
BYTE* pbElement;
DWORD cbElement;
//open certificate from file

hSystemStore = CertOpenSystemStore(0,L"CA"));
hFileStore = 
CertOpenStore(CERT_STORE_PROV_FILENAME,MY_ENCODING_TYPE,NULL,0,L"c:\\irenaCert.cer" ));
pCertContext=CertEnumCertificatesInStore(hSystemStore,pCertContext));

//assign the certificate to contact
IMessage *imsg=0; 
imsg=(IMessage *)(contactItem.get_MAPIOBJECT());
SPropValue propCer;
propCer.dwAlignPad=0;
propCer.ulPropTag=PR_USER_X509_CERTIFICATE;
propCer.Value.MVbin.cValues = 1;
SBinary binSig;
binSig.lpb=pCertContext->pbCertEncoded;
binSig.cb=pCertContext->cbCertEncoded; 
propCer.Value.MVbin.lpbin = &binSig;
propCer.Value.MVbin.lpbin->lpb = pCertContext->pbCertEncoded; //lpbCertBlob;
propCer.Value.MVbin.lpbin->cb =pCertContext->cbCertEncoded; //cbCertBlob;
LPSPropProblemArray pProblemArray=0;
HRESULT resProp=imsg->SetProps(1,(LPSPropValue)&propCer,&pProblemArray);
resProp=imsg->SaveChanges(FORCE_SAVE);
free(pbElement);
CertCloseStore(hSystemStore,0);
}

So everything goues fine and the value is set but the outlook cannot 
recognize the certificate. I found out that the problem is in binary data 
format and size and here i need help . How to generate the binary data so the 
outlook can reconize the certificate.

Thanks,
Stojan
date: Fri, 11 Jan 2008 08:47:02 -0800   author:   Gancev

Re: PR_USER_X509_CERTIFICATE value and Outlook contacts certificate   
Hi Stojan,



There is some extra data before and after the actual certificate.

Generally the actual certificate is shifted by 12 bytes (offset 12).



I can explain in BG if you e-mail me to somebody mailbox hosted inside 
imibo.com server





 Regards,

Ivan



"Gancev"  wrote in message 
news:590F19D6-9EE9-4BC5-80E6-3F5F4D5D9789@microsoft.com...
> Hi,
> I am trying to make a code that will import certificate file for contact
> using c++.
> The think is i didnt found anithing on the net but with outlook spy and 
> MFC
> mapi i conclude that PR_USER_X509_CERTIFICATE is the value where the
> certificate(s) should be stored. This is the part of the code i use to 
> assign
> the certificate to a contact item in outlook:
> {
> #define PR_USER_X509_CERTIFICATE  PROP_TAG( PT_MV_BINARY, 0x3A70)
> #define MY_ENCODING_TYPE (PKCS_7_ASN_ENCODING | X509_ASN_ENCODING)
> HCERTSTORE hSystemStore;
> HCERTSTORE hFileStore;
> PCCERT_CONTEXT pCertContext = NULL;
> TCHAR pszNameString[256];
> BYTE* pbElement;
> DWORD cbElement;
> //open certificate from file
>
> hSystemStore = CertOpenSystemStore(0,L"CA"));
> hFileStore =
> CertOpenStore(CERT_STORE_PROV_FILENAME,MY_ENCODING_TYPE,NULL,0,L"c:\\irenaCert.cer" 
>  ));
> pCertContext=CertEnumCertificatesInStore(hSystemStore,pCertContext));
>
> //assign the certificate to contact
> IMessage *imsg=0;
> imsg=(IMessage *)(contactItem.get_MAPIOBJECT());
> SPropValue propCer;
> propCer.dwAlignPad=0;
> propCer.ulPropTag=PR_USER_X509_CERTIFICATE;
> propCer.Value.MVbin.cValues = 1;
> SBinary binSig;
> binSig.lpb=pCertContext->pbCertEncoded;
> binSig.cb=pCertContext->cbCertEncoded;
> propCer.Value.MVbin.lpbin = &binSig;
> propCer.Value.MVbin.lpbin->lpb = pCertContext->pbCertEncoded; 
> //lpbCertBlob;
> propCer.Value.MVbin.lpbin->cb =pCertContext->cbCertEncoded; //cbCertBlob;
> LPSPropProblemArray pProblemArray=0;
> HRESULT resProp=imsg->SetProps(1,(LPSPropValue)&propCer,&pProblemArray);
> resProp=imsg->SaveChanges(FORCE_SAVE);
> free(pbElement);
> CertCloseStore(hSystemStore,0);
> }
>
> So everything goues fine and the value is set but the outlook cannot
> recognize the certificate. I found out that the problem is in binary data
> format and size and here i need help . How to generate the binary data so 
> the
> outlook can reconize the certificate.
>
> Thanks,
> Stojan
date: Sat, 12 Jan 2008 12:03:39 +0200   author:   Ivan Borissov no spam

Re: PR_USER_X509_CERTIFICATE value and Outlook contacts certificat   
Привет, Иван.

Не могли бы вы здесь пояснить что это за блоки данных, обрамляющие 
сертификат. Тоже столкнулся с такой проблемой, а описания нигде не нашел. Ну 
или дайте почту, через которую с вами можно связаться.


<
Hello, Ivan.

Can you explain about this extra data here - in this topic. I'm also have 
this problem and don't find desicion yet. 

>



"Ivan Borissov" wrote:

> Hi Stojan,
> 
> 
> 
> There is some extra data before and after the actual certificate.
> 
> Generally the actual certificate is shifted by 12 bytes (offset 12).
> 
> 
> 
> I can explain in BG if you e-mail me to somebody mailbox hosted inside 
> imibo.com server
> 
> 
> 
> 
> 
>  Regards,
> 
> Ivan
> 
>
date: Sun, 17 Feb 2008 04:49:00 -0800   author:   mmtm123

Re: PR_USER_X509_CERTIFICATE value and Outlook contacts certificat   
I can read and understood Russian, but I not have courage to write in 
Russian (Ya ochen davno ne pisal po russki - bolee chem 20 let).



The same story is with C/C++ -> my preferred programming language is Pascal 
(Delphi)


I cannot post  code here - it is a part of commercial product.

Mne mozhna nayti na yaschike ivan kotoroy nahoditsya na servere imibo tochka 
com
You can reach me at mailbox ivan hosted from server imibo dot com



"mmtm123"  wrote in message
news:29F7CD62-8BAE-451D-BDAA-017A7279E447@microsoft.com...
| ðÒÉ×ÅÔ, é×ÁÎ.
|
| îÅ ÍÏÇÌÉ ÂÙ ×Ù ÚÄÅÓØ ÐÏÑÓÎÉÔØ ÞÔÏ ÜÔÏ ÚÁ ÂÌÏËÉ ÄÁÎÎÙÈ, ÏÂÒÁÍÌÑÀÝÉÅ
| ÓÅÒÔÉÆÉËÁÔ. ôÏÖÅ ÓÔÏÌËÎÕÌÓÑ Ó ÔÁËÏÊ ÐÒÏÂÌÅÍÏÊ, Á ÏÐÉÓÁÎÉÑ ÎÉÇÄÅ ÎÅ ÎÁÛÅÌ.
îÕ
| ÉÌÉ ÄÁÊÔÅ ÐÏÞÔÕ, ÞÅÒÅÚ ËÏÔÏÒÕÀ Ó ×ÁÍÉ ÍÏÖÎÏ Ó×ÑÚÁÔØÓÑ.
|
|
| <
| Hello, Ivan.
|
| Can you explain about this extra data here - in this topic. I'm also have
| this problem and don't find desicion yet.
|
| >
|
|
|
| "Ivan Borissov" wrote:
|
| > Hi Stojan,
| >
| >
| >
| > There is some extra data before and after the actual certificate.
| >
| > Generally the actual certificate is shifted by 12 bytes (offset 12).
| >
| >
| >
| > I can explain in BG if you e-mail me to somebody mailbox hosted inside
| > imibo.com server
| >
| >
| >
| >
| >
| >  Regards,
| >
| > Ivan
| >
| >
date: Sun, 17 Feb 2008 18:58:15 +0200   author:   Ivan Borissov no_spam_to_me

Re: PR_USER_X509_CERTIFICATE value and Outlook contacts certificat   
Hello, Ivan.

See your e-mail, please.


"Ivan Borissov" wrote:

> I can read and understood Russian, but I not have courage to write in 
> Russian (Ya ochen davno ne pisal po russki - bolee chem 20 let).
> 
> 
> 
> The same story is with C/C++ -> my preferred programming language is Pascal 
> (Delphi)
> 
> 
> I cannot post  code here - it is a part of commercial product.
> 
> Mne mozhna nayti na yaschike ivan kotoroy nahoditsya na servere imibo tochka 
> com
> You can reach me at mailbox ivan hosted from server imibo dot com
> 
> 
>
date: Sun, 17 Feb 2008 22:49:00 -0800   author:   mmtm123

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us