30 #elif defined (HAVE_RPC_DES_CRYPT_H) 31 #include <rpc/des_crypt.h> 42 static BYTE des_Keyblob[] = {
43 0x08, 0x02, 0x00, 0x00, 0x01, 0x66, 0x00, 0x00,
44 0x08, 0x00, 0x00, 0x00,
45 'U',
'9',
'a',
'$',
'y',
'1',
'@',
'z' 64 char default_key[] = { 10, 7, 1, 9, 12, 2, 11, 2, 12, 19, 1, 12, 9, 7, 11, 15 };
73 memcpy (des_Keyblob + 12, key, 8);
74 #elif defined (HAVE_RPC_DES_CRYPT_H) 98 DWORD padding = PKCS5_PADDING;
99 DWORD cipher_mode = CRYPT_MODE_ECB;
103 if (CryptAcquireContext (&hProv,
NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
106 if (!CryptImportKey (hProv, des_Keyblob,
sizeof (des_Keyblob), 0, CRYPT_EXPORTABLE, &hKey))
113 if (!CryptSetKeyParam (hKey, KP_MODE, (PBYTE) & cipher_mode, 0))
119 if (!CryptSetKeyParam (hKey, KP_PADDING, (PBYTE) & padding, 0))
124 dwLength = (int)
strlen (line);
125 memcpy (pbBuffer, line, dwLength);
128 if (!CryptEncrypt (hKey, 0,
TRUE, 0, pbBuffer, &dwCount, 2048))
132 memcpy (crypt, pbBuffer, dwCount);
133 crypt[dwCount] = 0x00;
136 CryptReleaseContext (hProv, 0);
143 #elif defined (HAVE_RPC_DES_CRYPT_H) 147 unsigned char inbuf[2048];
148 unsigned char padchar;
150 inlen = strnlen (line,
sizeof (inbuf));
151 strncpy ((
char *) inbuf, line, inlen);
154 padchar = 8 - (inlen % 8);
155 padlen = (int) padchar;
157 for (i = 0; i < padlen; i++)
159 inbuf[inlen +
i] = padchar;
164 if (DES_FAILED (ecb_crypt (
crypt_Key, (
char *) inbuf, inlen, DES_ENCRYPT)))
168 memcpy (crypt, inbuf, inlen);
171 crypt[outlen] =
'\0';
175 int line_len = (int)
strlen (line);
184 memcpy (crypt, dest, outlen);
187 crypt[outlen] =
'\0';
215 for (i = 0; i < 5; i++)
int crypt_encrypt_printable(const char *line, char *crypt, int maxlen)
int SHA1Result(SHA1Context *context)
unsigned Message_Digest[5]
void crypt_seed(const char *key)
void SHA1Input(SHA1Context *context, const unsigned char *message_array, size_t length)
#define db_private_free_and_init(thrd, ptr)
int crypt_default_encrypt(THREAD_ENTRY *thread_p, const char *src, int src_len, const char *key, int key_len, char **dest_p, int *dest_len_p, CIPHER_ENCRYPTION_TYPE enc_type)
int crypt_encrypt_sha1_printable(const char *line, char *crypt, int maxlen)
void SHA1Reset(SHA1Context *context)