Re: problems with making Encrypted mail using SFL

"wooce" <[email protected]> Tue, 27 Nov 2001 00:00:08 -0800
Newsgroups gmane.ietf.sfl
Message-ID <[email protected]>
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 ----- 
  From: William Adams 
  To: 'wooce' ; SFL List (E-mail) 
  Sent: Wednesday, October 17, 2001 2:28 AM
  Subject: RE: problems with making Encrypted mail using SFL


  You can use the 

  void CSM_CSInst::GetAlgs(CSM_AlgLst **ppdigestAlgID,CSM_AlgLst **ppdigestEncryptionAlgID,CSM_AlgLst **ppkeyEncryptionAlgID,CSM_AlgLst **ppcontentEncryptionAlgID);

  function to get the supported algs for each instance.

  -----Original Message-----
  From: [email protected] [mailto:[email protected]]On Behalf Of wooce
  Sent: 17 October 2001 11:16
  To: imc-sfl
  Subject: problems with making Encrypted mail using SFL


   hi all, 
        Sorry for I'm a new comer to SFL and this mailing list.   Please forgive me for asking so  simple problems.  
    I write  a program  to  make enveloped mail  by SFL.     But it reports: 
      ERROR INFORMATION AND STACK:

   ERROR INFORMATION: no instance supports requested cont encr alg
          ERROR CODE: 1006        SOURCE LINE NUMBER: 1165
          FILE: sm_Encrypt.cpp
          FUNCTION: CSM_DataToEncrypt::Encrypt

       now I find that it's probably for I passed the wrong contentEncryptionOID to pEncryptMsg :  
     
      CSM_MsgToEncrypt *pEncryptMsg;
      CSM_OID oidEncryptedData(id_encryptedData);
      pEncryptMsg->SetContentEncryptOID(&contentEncryptionOID);

     1) How should I  get  the    CSM_OID object to pass it to  pEncryptMsg->SetContentEncryptOID()  function?
    2)  How  can I  see   the list of  the Algorithm OIDs supported by the available instances?   

  sincerely,
  Wooce
  [email protected]