diff options
author | Werner Koch <[email protected]> | 1998-08-05 16:51:59 +0000 |
---|---|---|
committer | Werner Koch <[email protected]> | 1998-08-05 16:51:59 +0000 |
commit | 9b609091ab3249a41c3a9f2417ba0250405792c8 (patch) | |
tree | eac3b271488722262dd71f003641d88d35fb64a1 /g10/pubkey-enc.c | |
parent | add coprocess facility (diff) | |
download | gnupg-9b609091ab3249a41c3a9f2417ba0250405792c8.tar.gz gnupg-9b609091ab3249a41c3a9f2417ba0250405792c8.zip |
intermediate check in
Diffstat (limited to 'g10/pubkey-enc.c')
-rw-r--r-- | g10/pubkey-enc.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/g10/pubkey-enc.c b/g10/pubkey-enc.c index 90cd26036..98ad2d3ae 100644 --- a/g10/pubkey-enc.c +++ b/g10/pubkey-enc.c @@ -28,6 +28,7 @@ #include "packet.h" #include "mpi.h" #include "keydb.h" +#include "trustdb.h" #include "cipher.h" #include "status.h" @@ -124,6 +125,20 @@ get_session_key( PKT_pubkey_enc *k, DEK *dek ) } if( DBG_CIPHER ) log_hexdump("DEK is:", dek->key, dek->keylen ); + /* check that the algo is in the preferences */ + { + PKT_public_key *pk = m_alloc_clear( sizeof *pk ); + if( (rc = get_pubkey( pk, k->keyid )) ) + log_error("public key problem: %s\n", g10_errstr(rc) ); + else if( !pk->local_id && query_trust_record(pk) ) + log_error("can't check algorithm against preferences\n"); + else if( dek->algo != CIPHER_ALGO_3DES + && !is_algo_in_prefs( pk->local_id, PREFTYPE_SYM, dek->algo ) ) + log_info("note: cipher algorithm %d not found in preferences\n", + dek->algo ); + free_public_key( pk ); + rc = 0; + } leave: mpi_free(plain_dek); |