1
0
Fork 0
mirror of git://git.gnupg.org/gnupg.git synced 2025-07-03 22:56:33 +02:00

Tweaked v3 -c decryption, let --force-v4-certs use SHA-1 for all RSA keys.

This commit is contained in:
Werner Koch 2001-11-08 16:24:04 +00:00
parent 961e45bf15
commit 0a036b6b03
4 changed files with 39 additions and 9 deletions

View file

@ -421,12 +421,33 @@ proc_encrypted( CTX c, PACKET *pkt )
if( opt.list_only )
result = -1;
else if( !c->dek && !c->last_was_session_key ) {
int algo = opt.def_cipher_algo ? opt.def_cipher_algo
: opt.s2k_cipher_algo;
int algo;
STRING2KEY s2kbuf, *s2k = NULL;
/* assume this is old style conventional encrypted data */
log_info(_("assuming %s encrypted data\n"),
cipher_algo_to_string (algo) );
c->dek = passphrase_to_dek( NULL, 0, algo, NULL, 0);
if ( (algo = opt.def_cipher_algo))
log_info (_("assuming %s encrypted data\n"),
cipher_algo_to_string(algo));
else if ( check_cipher_algo(CIPHER_ALGO_IDEA) ) {
algo = opt.def_cipher_algo;
if (!algo)
algo = opt.s2k_cipher_algo;;
log_info (_("IDEA cipher unavailable, "
"optimistically attempting to use %s instead\n"),
cipher_algo_to_string(algo));
}
else {
algo = CIPHER_ALGO_IDEA;
if (!opt.def_digest_algo) {
/* If no digest is given we assume MD5 */
s2kbuf.mode = 0;
s2kbuf.hash_algo = DIGEST_ALGO_MD5;
s2k = &s2kbuf;
}
log_info (_("assuming %s encrypted data\n"), "IDEA");
}
c->dek = passphrase_to_dek ( NULL, 0, algo, s2k, 0 );
if (c->dek)
c->dek->algo_info_printed = 1;
}