|
xrootd
|
00001 /* ----------------------------------------------------------------------- * 00002 * * 00003 * PC3.cc * 00004 * * 00005 * C++ adaptation of PKEP implementation written by Alexander PUKALL 1991. * 00006 * * 00007 * PKEP ( Pukall Key Exchange Protocol (c) Alexander PUKALL 1997 * 00008 * * 00009 * Reference: http://membres.lycos.fr/pc1/ * 00010 * * 00011 * Description: * 00012 * Algorithm allowing the secure exchange of a random password using the * 00013 * PC3 cipher for random number generation based on a 160-bit seed. * 00014 * Initialization creates private and public parts; exponentiation builds * 00015 * the key using the received public part. * 00016 * * 00017 * Created Key length is 256 bits (32 bytes). Input random string can be * 00018 * up to 256 bytes, but 32 or 64 should be typically enough. * 00019 * Buffers for private and public parts should be of length kPC3SLEN * 00020 * * 00021 * Fro the author: * 00022 * Free code no restriction to use please include the name of the Author * 00023 * in the final software * 00024 * * 00025 * Adapted by G. Ganis (g.ganis@cern.ch), February 2005 * 00026 * ----------------------------------------------------------------------- */ 00027 00028 typedef unsigned char uchar; 00029 00030 #define kPC3SLEN 33 00031 #define kPC3MAXRPWLEN 256 00032 #define kPC3MINBITS 128 00033 #define kPC3KEYLEN 32 00034 00035 int PC3InitDiPuk(uchar *rpwd, unsigned int lrpw, uchar *pub, uchar *priv); 00036 int PC3DiPukExp(uchar *pub, uchar *priv, uchar *key);
1.7.6.1