On Tue, Feb 16, 2010 at 3:53 PM, Ben Boeckel <maths...@gmail.com> wrote: > -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA256 > > Hi, > > I am working on a project that requires hashing data. Unfortunately, I > have been unable to get NSS to return a valid context for hashing. Here > is the initialization code: > > 62 void chasm :: mylib_init() > - - 63 { > | 64 chasm_init_data.s_nspr_inited = PR_FALSE; > | 65 chasm_init_data.s_nss_inited = PR_FALSE; > | 66 > | 67 if (!PR_Initialized()) > |- 68 { > || 69 PR_Init(PR_USER_THREAD, PR_PRIORITY_NORMAL, 0); > || 70 > || 71 if (!PR_Initialized()) > || 72 _nss_error(); > || 73 > || 74 chasm_init_data.s_nspr_inited = PR_TRUE; > || 75 } > | 76 > | 77 if (!NSS_IsInitialized()) > |- 78 { > || 79 SECStatus status = NSS_Init(NULL); > || 80 > || 81 if (status != SECSuccess) > || 82 _nss_error(); > || 83 > || 84 chasm_init_data.s_nss_inited = PR_TRUE; > || 85 } > | 86 } > > Note: _nss_error() throws an exception. > > The initialization of NSS fails (nothing is in PR_GetErrorText however).
Hi Ben, You can call NSS_NoDB_Init(NULL), until your application needs to store certificates or private keys persistently in NSS databases. The reason your NSS_Init(NULL) call fails is that you're passing a NULL pointer to NSS_Init. Instead, you should pass a string that represents the pathname of the directory where you want to store your NSS databases. PR_GetErrorText is essentially an obsolete function now because it isn't adopted by NSPR clients. Call PR_GetError instead to get an error code, and look it up at http://www.mozilla.org/projects/security/pki/nss/ref/ssl/sslerr.html Wan-Teh -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto