This mailing list has been abandoned! Subscribe to and use the new list instead: http://cool.haxx.se/mailman/listinfo/libssh2-devel ----------------------------------------------------------------------
Bugs item #2731272, was opened at 2009-04-04 15:43 Message generated for change (Comment added) made by alamaison You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2731272&group_id=125852 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: None Priority: 5 Private: No Submitted By: Nobody/Anonymous (nobody) Assigned to: Daniel Stenberg (bagder) Summary: libssh2_userauth_publickey_fromfile crashed in windows XP Initial Comment: libssh2_userauth_publickey_fromfile crashed in windows XP. When I further debugged the problem , I found it was crashing in PEM_read_RSAPrivateKey (openssl.c). When I replaced this API with PEM_read_bio_RSAPrivateKey, things started working. May I know why this behavior - Harish Jadhav ---------------------------------------------------------------------- Comment By: alamaison (alamaison) Date: 2009-07-13 22:42 Message: Has any progress been made on this issue? I've spent the last few days trying to get pubkey authentication working and am suffering the same problem. The solution may be to go the BIO route as suggested by Harish. For example, an early version of TOR had a function like this: int crypto_pk_read_private_key_from_file(crypto_pk_env_t *env, FILE *src) { assert(env && src); if (env->key) RSA_free(env->key); env->key = PEM_read_RSAPrivateKey(src, NULL, NULL, NULL); if (!env->key) return -1; return 0; } When people started having issues with this on Windows so that the file contents were read on the TOR side, put into a BIO and passed to the OpenSSL dll (changeset 2354 of /tor/trunk/src/common/crypto.c https://svn.torproject.org/cgi-bin/viewvc.cgi/tor/trunk/src/common/crypto.c?view=log#rev2354): int crypto_pk_read_private_key_from_filename(crypto_pk_env_t *env, const char *keyfile) { char *contents; int r; /* Read the file into a string. */ contents = read_file_to_str(keyfile, 0, NULL); if (!contents) { log_warn(LD_CRYPTO, "Error reading private key from \"%s\"", keyfile); return -1; } /* Try to parse it. */ r = crypto_pk_read_private_key_from_string(env, contents); tor_free(contents); if (r) return -1; /* read_private_key_from_string already warned, so we don't.*/ /* Make sure it's valid. */ if (crypto_pk_check_key(env) <= 0) return -1; return 0; } int crypto_pk_read_private_key_from_string(crypto_pk_env_t *env, const char *s) { BIO *b; tor_assert(env); tor_assert(s); /* Create a read-only memory BIO, backed by the nul-terminated string 's' */ b = BIO_new_mem_buf((char*)s, -1); if (env->key) RSA_free(env->key); env->key = PEM_read_bio_RSAPrivateKey(b,NULL,NULL,NULL); BIO_free(b); if (!env->key) { crypto_log_errors(LOG_WARN, "Error parsing private key"); return -1; } return 0; } I might try to knock something like this together for libssh2, time permitting, but I'd rather not go to the effort if it's already been solved. Alex -- http://swish.sourceforge.net ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2009-06-08 09:01 Message: Can you please clarify what exaclty is the issue? I tried writing sample dll api which accepts FILE * as argument and also successfully accessed from other Dll which inturn used by execatable. Also, please let me what is your suggestion on this. ---------------------------------------------------------------------- Comment By: Daniel Stenberg (bagder) Date: 2009-06-04 17:17 Message: Are you using the OpenSSL as a DLL? It so feels like a problem with passing a FILE * between DLL boundaries which simply isn't allowed in windows. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2009-04-06 06:38 Message: I know PEM_read_RSAPrivateKey uses File * and when I pass file pointer to this function, this was leading to crash. Some one else also had a problem. Pls refer http://www.mail-archive.com/libssh2-devel@lists.sourceforge.net/msg00758.html should make sense. ---------------------------------------------------------------------- Comment By: Daniel Stenberg (bagder) Date: 2009-04-04 22:12 Message: It makes no sense, the function reads data from a FILE * not a BIO *! https://www.openssl.org/docs/crypto/pem.html seems to document these specific functions. Can you make any sense from it? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=703942&aid=2731272&group_id=125852 ------------------------------------------------------------------------------ Enter the BlackBerry Developer Challenge This is your chance to win up to $100,000 in prizes! For a limited time, vendors submitting new applications to BlackBerry App World(TM) will have the opportunity to enter the BlackBerry Developer Challenge. See full prize details at: http://p.sf.net/sfu/Challenge _______________________________________________ libssh2-devel mailing list libssh2-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/libssh2-devel