Sign in Join
Wiki copytemporary

DCPcrypt/es

Deutsch · English · Español · Français · Suomi

Sobre

Los componentes en el IDE de Lazarus

Autores

Licencias

   Licencia del MIT

   Por razones legales, no se traduce el texto en inglés de la licencia, para una mejor comprensión ver 1:

   Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

   The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Descarga

   El paquete se puede descargar desde el sitio Lazarus CCR SourceForge.

Dependencias / Requirimientos de sistema

   Probado en Linux y Windows XP.

Instalación

Utilización

   Tenga en cuenta que un conocimiento de los principios básicos de cifrado / descifrado y de la gestión de claves es necesario para garantizar la correcta utilización de los algoritmos de cifrado implemetnados en este paquete. Una buena introducción sobre este tema se proporciona por Bruce Schneier en "Applied Cryptography" (ISBN: 0-471-11709-9) ver también la publicación NIST SP800-38 para obtener información sobre los modos de encadenamiento de bloques de cifrado.

Ver la documentación incluida.

Fallos

   Si está utilizando DCPrijndael, hay que tener presente que tamaños de las claves distintas de las del estándar AES producen cuadros clave que no son intercambiables con otras implementaciones de Rijndael. Pocos proporcionan implementaciones no estándar del tamaño de la clave (o bloque). Brian Gladman y Jeffrey Clement proporcionan implementaciones (C y Python) que se sabe que son incompatibles con DCPrijndael para tamaños no estándar de clave. El Programa de prueba comentado que sigue muestra los resultados esperados:

pascal
  program ctst;
  {$mode objfpc}{$H+}
  uses
    {$IFDEF UNIX}{$IFDEF UseCThreads}
    cthreads,
    {$ENDIF}{$ENDIF}
    Sysutils, DCPrijndael;
  const
    InData: array[0..15] of byte=
      ($32,$43,$f6,$a8,$88,$5a,$30,$8d,$31,$31,$98,$a2,$e0,$37,$07,$34);
    Key1: array[0..19] of byte=
      ($2b,$7e,$15,$16,$28,$ae,$d2,$a6,$ab,$f7,$15,$88,$09,$cf,$4f,$3c,$76,$2e,$71,$60);
    Key2: array[0..31] of byte=
      ($2b,$7e,$15,$16,$28,$ae,$d2,$a6,$ab,$f7,$15,$88,$09,$cf,$4f,$3c,$76,$2e,$71,$60,
       $f3,$8b,$4d,$a5,$6a,$78,$4d,$90,$45,$19,$0c,$fe);
    OutData1: array[0..15] of byte=
      ($23,$1d,$84,$46,$39,$b3,$1b,$41,$22,$11,$cf,$e9,$37,$12,$b8,$80);
    OutData2: array[0..15] of byte=
      ($1a,$6e,$6c,$2c,$66,$2e,$7d,$a6,$50,$1f,$fb,$62,$bc,$9e,$93,$f3);
  var
    Cipher: TDCP_rijndael;
    Block: array[0..15] of byte;
  begin
  // lengths:  block = 16 bytes, key = 20 bytes
  // key     = 2b7e151628aed2a6abf7158809cf4f3c762e7160
  // input   = 3243f6a8885a308d313198a2e0370734
  // encrypt = 231d844639b31b412211cfe93712b880
  // decrypt = 3243f6a8885a308d313198a2e0370734
    Cipher:= TDCP_rijndael.Create(nil);
    Cipher.Init(Key1,Sizeof(Key1)*8,nil);
    Cipher.EncryptECB(InData,Block);
    writeln('128-bit block & 160-bit key results:');
    writeln(boolean(CompareMem(@Block,@OutData1,16)));
    Cipher.DecryptECB(Block,Block);
    writeln(boolean(CompareMem(@Block,@InData,16)));
  // lengths:  block = 16 bytes, key = 32 bytes
  // key     = 2b7e151628aed2a6abf7158809cf4f3c762e7160f38b4da56a784d9045190cfe
  // input   = 3243f6a8885a308d313198a2e0370734
  // encrypt = 1a6e6c2c662e7da6501ffb62bc9e93f3
  // decrypt = 3243f6a8885a308d313198a2e0370734
    Cipher:= TDCP_rijndael.Create(nil);
    Cipher.Init(Key2,Sizeof(Key2)*8,nil);
    Cipher.EncryptECB(InData,Block);
    writeln('128-bit block & 256-bit key results:');
    writeln(boolean(CompareMem(@Block,@OutData2,16)));
    Cipher.DecryptECB(Block,Block);
    writeln(boolean(CompareMem(@Block,@InData,16)));
  end.

   La salida que freepascal 2.2.0 produce es :

text
  128-bit block & 160-bit key results:
  FALSE
  TRUE
  128-bit block & 256-bit key results:
  TRUE
  TRUE

   Esto muestra que usando de claves de 160 bits sólo se puede descifrar la salida con DCPrijndael, pero no va a trabajar con otras implementaciones. Por otra parte, 256 bits son interoperables. El caso de 160-bits es importante porque SHA-1 produce resúmenes de 160-bits, lo que lo convierte en una manera adecuada para generar una clave de una contraseña, por lo que es utilizado por algunos sistemas (hardware).

Colaboradores


From the Free Pascal wiki, page "DCPcrypt/es", as it stood on 2020-02-12 after a change by Trev, out of the wiki's dump of 2024-05-26. Copyright stays with the author who wrote it, according to the old wiki's Licensing page. If you have concerns about this material, message the admin.

Revision 2, last changed by WikiArchive .

Talk about this page

Nobody has opened a bench for this page yet. Sign in to open one.