Java passphrase encryption

前端 未结 6 1714
情话喂你
情话喂你 2020-12-15 12:57

I\'m trying to learn how to do passphrase-based encryption with Java. I\'m finding several examples online, but none (yet) on Stack Overflow. The examples are a little lig

6条回答
  •  孤城傲影
    2020-12-15 13:42

    You need an encryption library, which will tell you how to set it up.
    I happen to like the stuff from bouncycastle.org. You can find their how to here The DES the refer to in the 5.1 example, is one of the encryptions they offer. What the actual string means, will depend on the provider. Essentially you load the library.

    Security.addProvider(new BouncyCastleProvider());
    

    And then only use the JCE interfaces to do whatever you want:

     keyGen = KeyGenerator.getInstance("DES", "BC");
    

    Java handles the binding of the library and the interfaces for you, you don't have to do that. I'd be more then happy to explain more, if you have any questions. Unfortunately at the moment I'm suffering from "I can't remember how I learned it" disease, so please feel free to ask.

提交回复
热议问题