c est une question de tuturial traduit de langlais par mes soins
le code suivant est utilise dans un programmme de verification de password.
Code :
- char user[10], passwd[10], crypt[10], cpwd[10];
- void encrypt () { ... }
- void getpwd() { ... }
- readwd (str)
- char *str;
- {
- int ch;
- while ((ch = getchar ()) != '\n' && ch != EOF)
- *str++ = ch;
- *str = 0; /* NULL terminate the string */
- }
- ...
- /* Check user and password */
- readwd (user); /* Read in user's name */
- getpwd (user, crypt); /* Get user password from file */
- echo_off (); /* No echo while reading password */
- readwd (passwd); /* Read password from user */
- echo_on ();
- encrypt (passwd, cpwd); /* Encrypt password to compare */
- if (strcmp (crypt, cpwd) != 0)) {
- printf ("Bad password\n" );
- exit (1);
- }
|
Quelles characteristiques de l algo le rende raisonnablement securise.
What are the features of this password scheme which help make it reasonably secure?
le cryptage du pass ? encrypt (passwd, cpwd);
Le prog ci-dessus pose quelque problems quand a son implementation en C. Dans quelles mesures le programme de verification de pass pourrait echouer dans loptique d une securite adequate.
cest la que je vois pas
The above scheme has some problems with the way it is implemented in C. In what ways might the above password checking facility fail to provide adequate security? (Hint: look carefully at readwd.)
merci,