Re: NSS open multiple NSS-Databses at once?

Opa114 <[email protected]>
Newsgroups gmane.comp.mozilla.crypto
Message-ID <[email protected]>
Am Dienstag, 10. Januar 2017 22:24:10 UTC+1 schrieb Robert Relyea:
> On 01/10/2017 10:18 AM, Opa114 wrote:
> > thanks, but these facts i know.
> > I don't want top let multiple applications open one Database, i want to open multiple different Mozilla databases, in the old standard format, with one (my) application.
> >
> > I tried to use the NSS_Init functions. These works with openening one database, but when i open a second one the whole application crashes,so that's why i asked the question and may be get some working example c++ code?
> 1) Where are you crashing (it's not expected to work, but I don't expect 
> a crash because you called NSS_Init again).
> 
> 2) To open additional databases you want to use SECMOD_OpenUserDB:
> 
> https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/PKCS11_Functions#SECMOD_OpenUserDB
> 
> You can call that multiple times.
> Once the database is opened any of the NSS find functions will find all 
> the certs in both databases. The slot returned from SECOMD_OpenUserDB 
> can be used in functions that take a slot to narrow the operations just 
> to that particular database.
> 
> To NSS each database will look basically like a smart card.
> 
> When you are through with that database you can use SECMOD_CloseUserDB()
> 
> bob


thanks for reply. Here are first some little code of which did not work, that means it crashes:

functionLoadFirefox() {
SECStatus rv = NSS_InitReadWrite(PATH_TO_FF_DB);
... if success load Certificates with PK11_ListCerts(PK11CertListAll, NULL);
NSS_Shutdown();
}

functionLoadThunderbird() {
SECStatus rv = NSS_InitReadWrite(PATH_TO_TB_DB);
... if success load Certificates with PK11_ListCerts(PK11CertListAll, NULL);
NSS_Shutdown();
}

So these are my two functions in which i opened and clos the databases and retrieve the certificates.

--> 2) To open additional databases you want to use SECMOD_OpenUserDB
So this means. First i have to call NSS_Init with let's say firefox database ad the i have to call SECMOD_OpenUserDB with the thudnerbirddatabse, right? Or must i load both with the SECMOD_OpenUserDB?

--> Once the database is opened any of the NSS find functions will find all the certs in both databases
But i have to know from which databse the certificates are coming from. So i need to know that let's say Certificate ABC ist stored inside Firefox Databse and Certificate 123 is stored in Thunerbird Database. How can i do that? or is this not possible?
-- 
dev-tech-crypto mailing list
[email protected]
https://lists.mozilla.org/listinfo/dev-tech-crypto
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.