Skip to content

Commit 350072e

Browse files
committed
Refactoring
1 parent 005f360 commit 350072e

File tree

1 file changed

+7
-10
lines changed

1 file changed

+7
-10
lines changed

crypto-keyczar/src/main/java/de/dominikschadow/javasecurity/symmetric/AESEncryptionSample.java renamed to crypto-keyczar/src/main/java/de/dominikschadow/javasecurity/symmetric/AESEncryption.java

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -23,16 +23,17 @@
2323
import org.slf4j.LoggerFactory;
2424

2525
/**
26-
* Symmetric encryption sample with Keyczar. Loads the AES key from the sample key set, encrypts and decrypts sample text with it.
26+
* Symmetric encryption sample with Keyczar. Loads the AES key from the sample key set, encrypts and decrypts sample
27+
* text with it.
2728
*
2829
* @author Dominik Schadow
2930
*/
30-
public class AESEncryptionSample {
31-
private static final Logger LOGGER = LoggerFactory.getLogger(AESEncryptionSample.class);
31+
public class AESEncryption {
32+
private static final Logger LOGGER = LoggerFactory.getLogger(AESEncryption.class);
3233
private static final String KEYSET_PATH = "crypto-keyczar/src/main/resources/key-sets/encrypt/symmetric";
3334

3435
public static void main(String[] args) {
35-
AESEncryptionSample res = new AESEncryptionSample();
36+
AESEncryption res = new AESEncryption();
3637
final String initialText = "AES encryption sample text";
3738
try {
3839
String ciphertext = res.encrypt(initialText);
@@ -53,16 +54,12 @@ public static void main(String[] args) {
5354
*/
5455
private String encrypt(String initialText) throws KeyczarException {
5556
Crypter crypter = new Crypter(KEYSET_PATH);
56-
String ciphertext = crypter.encrypt(initialText);
57-
58-
return ciphertext;
57+
return crypter.encrypt(initialText);
5958
}
6059

6160
private String decrypt(String ciphertext) throws KeyczarException {
6261
Crypter crypter = new Crypter(KEYSET_PATH);
63-
String plaintext = crypter.decrypt(ciphertext);
64-
65-
return plaintext;
62+
return crypter.decrypt(ciphertext);
6663
}
6764

6865
private void printReadableMessages(String initialText, String ciphertext, String plaintext) {

0 commit comments

Comments
 (0)