Hello Driss,
  I think, it will be 
   
      theDESCheckResult = DES_set_key_checked(&theDESKey1, &theSchedule);
    DES_ecb_encrypt((DES_cblock *) &buff, (DES_cblock *) &theOutput, 
&theSchedule, DES_ENCRYPT);
   
  Namely that DES_ecb_encrypt is described like that :
   
  void DES_ecb_encrypt(const_DES_cblock *input, DES_cblock *output,
       DES_key_schedule *ks, int enc)
   
  See opennssl/crypto/des/ecb_enc.c
   
  Abderrahmane,
  

EL HACHIMI Driss <[EMAIL PROTECTED]> a écrit :
  Hello,

I need to encrypt a password with a DES key, I'm trying the following code:
      char * buff[20];
    int theDESCheckResult;
    DES_cblock * theDESKey1;
    DES_key_schedule *theSchedule;
    DES_cblock * theOutput;

    ALMLog (@"Enter your DBPassword");
    fgets((char *)&buff, 10, stdin);
 
        theDESKey1 = [[[NSProcessInfo processInfo] globallyUniqueString] 
UTF8String];
        RAND_seed(theDESKey1, strlen(theDESKey1));

    theDESCheckResult = DES_set_key_checked(theDESKey1, theSchedule);
    DES_ecb_encrypt(buff, theOutput, theSchedule, DES_ENCRYPT);

The DES key is correctly generated but the DES_set_key_checked () function 
returns -1 which means that the parity is wrong and the function 
DES_ecb_encrypt () cannot be executed.

Bests Regards
Driss
    
---------------------------------
  Envoyé avec Yahoo! Mail.
Capacité de stockage illimitée pour vos emails. 

       
---------------------------------
 Envoyé avec Yahoo! Mail.
Capacité de stockage illimitée pour vos emails. 

Reply via email to