Hi I've got to find out the keysize used in an S/MIME encrypted mail.
I looked around in the openssl code and tried the following: X509_ALGOR *alg; PKCS7 *p7; int p7_type; BIO *mail_bio *indata; ... p7 = SMIME_read_PKCS7(mail_bio, &indata); p7_type = OBJ_obj2nid(p7->type); switch (p7_type) { case NID_pkcs7_signedAndEnveloped: alg=p7->d.signed_and_enveloped->enc_data->algorithm; break; case NID_pkcs7_enveloped: alg=p7->d.enveloped->enc_data->algorithm; break; default; return; break; } printf("Alg: %s\n",OBJ_nid2sn(OBJ_obj2nid(alg->algorithm))); printf("Len: %ld\n",ASN1_INTEGER_get(alg->parameter->value.integer)); I then get the algorithm as desired: Alg: RC2-CBC or Alg: DES-EDE3-CBC but the keysize is always -1: Key: -1 Key: -1 In pk7_attr.c (lile 110) in PKCS7_simple_smimecap, the line 134 alg->parameter->value.integer = nbit; implies that the keysize is stored there, as the funcion is called in pk7_smime.c like this: PKCS7_simple_smimecap (smcap, NID_rc2_cbc, 128); What am I doing wrong. Bye Tim ______________________________________________________________________ OpenSSL Project http://www.openssl.org User Support Mailing List [EMAIL PROTECTED] Automated List Manager [EMAIL PROTECTED]