|
hi,
here is my program now:
CSM_AppLogin AppLogin;
CSM_AlgLst *ppdigestAlgID = new
CSM_AlgLst();
CSM_AlgLst *ppdigestEncryptionAlgID = new CSM_AlgLst(); CSM_AlgLst *ppkeyEncryptionAlgID = new CSM_AlgLst(); CSM_AlgLst *ppcontentEncryptionAlgID = new CSM_AlgLst(); char *dllname="libsm_free3DLL"; char *args="sm_free3DLL ./21cn.pfx 123456"; AppLogin.AddLogin(dllname,args);
// call AddLogin() function
CSM_CSInst *pInst; CSM_OID contentEOID(rc2_cbc); // OID is 1.2.840.113549.3.2 // testing process begin here....
CSM_Alg rc2Alg(contentEOID);
pInst = AppLogin.FindCSInstAlgIds(NULL,NULL,NULL,&rc2Alg); if( pInst==NULL) cout<<"no rc2 algorithm found!"; else cout<<"find rc2 algorithm instance!"; pInst->GetAlgIDs(ppdigestAlgID,ppdigestEncryptionAlgID,ppkeyEncryptionAlgID,ppcontentEncryptionAlgID);
CSM_Alg
*pAlg=ppcontentEncryptionAlgID->FirstL();
while( pAlg!=NULL ) { cout<<pAlg->GetId()->GetOIDDescription()<<","<<pAlg->GetId()->GetChar()<<"\n"; pAlg = ppcontentEncryptionAlgID->GoNext(); } // end of testing
process
smEncryptMsg.SetContentEncryptOID(ppcontentEncryptionAlgID->FirstL()->GetId());
but it still report "no instance supports
requested cont encr alg", and the testing process output:
find rc2 algorithm
instance!Instance:sha_1,1.3.14.3.2.26
id_dsa,1.2.840.10040.4.1 rsa,2.5.8.1.1 id_aes128_ECB,2.16.840.1.101.3.4.1.1 why I got the content encryption oid as
id_aes128_ECB(2.16.840.1.101.3.4.1.1) instead of
rc2_cbc(1.2.840.113549.3.2) from the
instance gained by
FindCSInstAlgIds(NULL,NULL,NULL,&rc2Alg) ? it seems
very strange.
How should I change the
program? I don't want to change the last statement
to smEncryptMsg.SetContentEncryptOID(&contentEOID);
I want to use the content encryption algorithm specified in the pfx file
"21cn.pfx".
Thank you and have a nice day.
Wooce. ----- Original Message -----
|