The WebCrypto API implementation in Firefox uses NSS to provide PBKDF2: http://hg.mozilla.org/mozilla-central/file/a255a234946e/dom/crypto/WebCryptoTask.cpp#l2333
Most of the stuff you're probably interested in happens in DoCrypto(). - Tim sdjfhas dufh wrote: > How do I use pbkdf2 in lib nss? It appears to be supported but I can not find > a useable example. The api page list functions but I don't know what to do > with them > https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Reference#PKCS_.235_functions > > I want to supply a password, choose the rounds then generate a specific > amount of bytes. Something like the below would work for me but I expect > actual usage wouldn't be like that > > char data_out[20]; //I need 20bytes of data from the password > int rounds = 50000; //1K is too quick these days > //password is null terminated > if(pbkdf2(pass, rounds, salt, &data_out, sizeof data_out) != 0) > {printf("Error");} > > Can someone give me a useable example? > > .NET has a complicated example but I can see what I want can be done in two > lines. I searched for nearly two hours and can't figure out how to do it in > nss. > > From > http://msdn.microsoft.com/en-us/library/system.security.cryptography.rfc2898derivebytes%28v=vs.110%29.aspx > > Rfc2898DeriveBytes k1 = new Rfc2898DeriveBytes(pwd1, salt1, myIterations); > k1.GetBytes(16); -- dev-tech-crypto mailing list dev-tech-crypto@lists.mozilla.org https://lists.mozilla.org/listinfo/dev-tech-crypto