3

I have really been struggling trying to get Bouncy Castle Scrypt going in my web app for password encryption. I am fairly new to programming in Java and security.

I have tried looking at Bouncy Castle's documentation for their Scrypt class. However, I have a really hard time trying to figure out how it works. It doesn't seem to really give much information as to how to create the class or anything like that.

I searched around Stack Exchange and Google to see if there is anywhere that could give me a good example as to what I should do to create this class. I found this question and answer, and I tried it out without creating a class, but that didn't seem to work either.

To top this off, my import doesn't seem to want to work either.

This is all of the code that I have:

import org.bouncycastle.crypto.generators;

public class SCrypt extends java.lang.Object {

    public Scrypt(){}

    public static byte[] generate(byte[] P,byte[] S,int N,int r,int p,int dkLen) {

    }
}

I want to use Scrypt since it seems to be the most secure in encrypting passwords, but it seems next impossible to implement. I'm really close with just going with a PBKDF2 since there is more documentation on it, but I'm hoping that there is someone out there who can help me get this going.

Jeel Vankhede
  • 11,592
  • 2
  • 28
  • 58
Perdue
  • 479
  • 9
  • 19
  • Scrypt will be memory intensive for a server-side web application. Bcrypt might be a better choice. – TheGreatContini Apr 09 '17 at 03:35
  • 2
    Why are you creating another `Scrypt` class? You just need to `import org.bouncycastle.crypto.generators.SCrypt` and then use the `generate` method: `SCrypt.generate(parameters...)`. Make sure to download bouncycastle jars in their site (or include in your `pom.xml` if you're using maven) –  Apr 10 '17 at 12:21

1 Answers1

2

Thanks Hugo for the feedback! After much struggle and searching, I found this website: http://www.itcsolutions.eu/2011/08/22/how-to-use-bouncy-castle-cryptographic-api-in-netbeans-or-eclipse-for-java-jse-projects/

This helped give me a breakdown step-by-step on what I needed to get Bouncy Castle up and running on my computer. I hope this will help others since I struggled with it for so long to find something that broke this down into layman's terms. :)

Perdue
  • 479
  • 9
  • 19