.\" -*- coding: UTF-8 -*- .\" Copyright 2000 Nicolás Lichtmaier .\" Created 2000-07-22 00:52-0300 .\" .\" %%%LICENSE_START(GPLv2+_DOC_FULL) .\" This is free documentation; you can redistribute it and/or .\" modify it under the terms of the GNU General Public License as .\" published by the Free Software Foundation; either version 2 of .\" the License, or (at your option) any later version. .\" .\" The GNU General Public License's references to "object code" .\" and "executables" are to be interpreted as the output of any .\" document formatting or typesetting system, including .\" intermediate and printed output. .\" .\" This manual is distributed in the hope that it will be useful, .\" but WITHOUT ANY WARRANTY; without even the implied warranty of .\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the .\" GNU General Public License for more details. .\" .\" You should have received a copy of the GNU General Public .\" License along with this manual; if not, see .\" . .\" %%%LICENSE_END .\" .\" Modified 2002-07-23 19:21:35 CEST 2002 Walter Harms .\" .\" .\" Modified 2003-04-04, aeb .\" .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH ENCRYPT 3 "1 novembre 2020" "" "Manuel du programmeur Linux" .SH NOM encrypt, setkey, encrypt_r, setkey_r \- Crypter des messages de 64\ bits .SH SYNOPSIS .nf \fB#define _XOPEN_SOURCE\fP /* Consultez feature_test_macros(7) */ \fB#include \fP .PP \fBvoid encrypt(char \fP\fIblock\fP\fB[64], int \fP\fIedflag\fP\fB);\fP \fB#define _XOPEN_SOURCE\fP /* Consultez feature_test_macros(7) */ \fB#include \fP .PP \fBvoid setkey(const char *\fP\fIkey\fP\fB);\fP \fB#define _GNU_SOURCE\fP /* Consultez feature_test_macros(7) */ \fB#include \fP .PP \fBvoid setkey_r(const char *\fP\fIkey\fP\fB, struct crypt_data *\fP\fIdata\fP\fB);\fP \fBvoid encrypt_r(char *\fP\fIblock\fP\fB, int \fP\fIedflag\fP\fB, struct crypt_data *\fP\fIdata\fP\fB);\fP .fi .PP Effectuez l'édition des liens avec l'option \fI\-lcrypt\fP. .SH DESCRIPTION Ces fonctions chiffrent et déchiffrent des messages de 64\ bits. La fonction \fBsetkey\fP() permet de fournir la clef à utiliser pour \fBencrypt\fP(). L'argument \fIkey\fP est une table de 64 octets, chacun ayant la valeur 0 ou 1. L'octet key[n] où n=8*i\-1 est ignoré, ce qui ramène la clef à 56 bits effectifs. .PP La fonction \fBencrypt\fP() modifie le tampon transmis, en l'encodant si l'argument \fIedflag\fP vaut 0, et en le décodant s'il vaut 1. L'argument \fIblock\fP est, comme l'argument \fIkey\fP, une représentation de la valeur à encoder sous forme de vecteur de bits. Le résultat est renvoyé dans le même vecteur. .PP Ces deux fonctions ne sont pas réentrantes, c'est\-à\-dire que la clef est stockée dans une zone de stockage statique. Les fonctions \fBsetkey_r\fP() et \fBencrypt_r\fP() sont des versions réentrantes. Elles utilisent la structure suivante pour contenir la clef\ : .PP .in +4n .EX struct crypt_data { char keysched[16 * 8]; char sb0[32768]; char sb1[32768]; char sb2[32768]; char sb3[32768]; char crypt_3_buf[14]; char current_salt[2]; long current_saltbits; int direction; int initialized; }; .EE .in .PP Avant d'appeler \fBsetkey_r\fP(), définissez \fIdata\->initialized\fP à zéro. .SH "VALEUR RENVOYÉE" Ces routines ne renvoient pas de valeur. .SH ERREURS Définissez \fIerrno\fP à zéro avant d'appeler les fonctions ci\-dessus. Si elles réussissent, \fIerrno\fP n'est pas modifiée. .TP \fBENOSYS\fP La fonction n'est pas disponible. (Par exemple à cause des restrictions américaines sur l'exportation de routines cryptographiques...) .SH VERSIONS Parce qu'elles emploient le chiffrement par bloc DES, qui n'est plus considéré comme sûr, les routines \fBcrypt\fP(), \fBcrypt_r\fP(), \fBsetkey\fP() et \fBsetkey_r\fP() ont été retirées dans la glibc\ 2.28. Les applications devraient passer à une bibliothèque de chiffrement moderne telle que \fBlibgcrypt\fP. .SH ATTRIBUTS Pour une explication des termes utilisés dans cette section, consulter \fBattributes\fP(7). .TS allbox; lbw23 lb lb l l l. Interface Attribut Valeur T{ \fBencrypt\fP(), \fBsetkey\fP() T} Sécurité des threads MT\-Unsafe race:crypt T{ \fBencrypt_r\fP(), \fBsetkey_r\fP() T} Sécurité des threads MT\-Safe .TE .SH CONFORMITÉ \fBencrypt\fP(), \fBsetkey\fP(): POSIX.1\-2001, POSIX.1\-2008, SUS, SVr4. .PP Les fonctions \fBencrypt_r\fP() et \fBsetkey_r\fP() sont des extensions GNU. .SH NOTES .SS "Disponibilité dans la glibc" Consultez \fBcrypt\fP(3). .SS "Fonctionnalités dans la glibc" Dans la glibc\ 2.2, ces fonctions utilisent l'algorithme DES. .SH EXEMPLES .EX #define _XOPEN_SOURCE #include #include #include #include int main(void) { char key[64]; char orig[9] = "eggplant"; char buf[64]; char txt[9]; for (int i = 0; i < 64; i++) { key[i] = rand() & 1; } for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { buf[i * 8 + j] = orig[i] >> j & 1; } setkey(key); } printf("Avant chiffrement : %s\en", orig); encrypt(buf, 0); for (int i = 0; i < 8; i++) { for (int j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) { txt[i] |= buf[i * 8 + j] << j; } txt[8] = \(aq\e0\(aq; } printf("Après chiffrement : %s\en", txt); encrypt(buf, 1); for (int i = 0; i < 8; i++) { for (int j = 0, txt[i] = \(aq\e0\(aq; j < 8; j++) { txt[i] |= buf[i * 8 + j] << j; } txt[8] = \(aq\e0\(aq; } printf("Après déchiffrement : %s\en", txt); exit(EXIT_SUCCESS); } .EE .SH "VOIR AUSSI" .\" .BR fcrypt (3) \fBcbc_crypt\fP(3), \fBcrypt\fP(3), \fBecb_crypt\fP(3), .SH COLOPHON Cette page fait partie de la publication\ 5.10 du projet \fIman\-pages\fP Linux. Une description du projet et des instructions pour signaler des anomalies et la dernière version de cette page peuvent être trouvées à l'adresse \%https://www.kernel.org/doc/man\-pages/. .PP .SH TRADUCTION La traduction française de cette page de manuel a été créée par Christophe Blaess , Stéphan Rafin , Thierry Vignaud , François Micaux, Alain Portal , Jean-Philippe Guérard , Jean-Luc Coulon (f5ibh) , Julien Cristau , Thomas Huriaux , Nicolas François , Florentin Duneau , Simon Paillard , Denis Barbier , David Prévot et Jean-Pierre Giraud . .PP Cette traduction est une documentation libre ; veuillez vous reporter à la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License version 3 .UE concernant les conditions de copie et de distribution. Il n'y a aucune RESPONSABILITÉ LÉGALE. .PP Si vous découvrez un bogue dans la traduction de cette page de manuel, veuillez envoyer un message à .MT debian-l10n-french@lists.debian.org .ME .