forked from MCZbase/DataShot_DesktopApp
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add encryption/decryption capabilities for Hibernate PW
- Loading branch information
Showing
3 changed files
with
35 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/main/java/edu/harvard/mcz/imagecapture/EncryptPassword.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package edu.harvard.mcz.imagecapture; | ||
|
||
import org.jasypt.util.text.AES256TextEncryptor; | ||
|
||
import java.util.Scanner; | ||
|
||
public class EncryptPassword { | ||
|
||
/** | ||
* | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
Scanner in = new Scanner(System.in); | ||
System.out.println("Please enter the password you want to encrypt"); | ||
String passwordToEncrypt = in.nextLine(); | ||
System.out.println("Please enter the password for the encryption"); | ||
String encryptPassword = in.nextLine(); | ||
AES256TextEncryptor textEncryptor = new AES256TextEncryptor(); | ||
textEncryptor.setPassword(encryptPassword); | ||
System.out.println(textEncryptor.encrypt(passwordToEncrypt)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters