-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathb3.java
More file actions
25 lines (20 loc) · 1.04 KB
/
Copy pathb3.java
File metadata and controls
25 lines (20 loc) · 1.04 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import java.io.File;
import com.Krypto.exceptions.KryptoException;
import com.Krypto.models.SymmetricStreamingCipher;
import com.Krypto.Krypto;
public class class2 {
public static void main(String[] args) {
String resourcesPath = "path/to/your/resources/";
SymmetricStreamingCipher symmetricStreamingCipher =
Krypto.symmetricEncryption()
.generateKey()
.plainFileStream(new File(resourcesPath + "input/plainTextFile.txt"), new File(resourcesPath + "output/cipherTextFile.txt"))
.encrypt();
Krypto.symmetricDecryption()
.key(symmetricStreamingCipher.key())
.iv(symmetricStreamingCipher.iv())
.cipherFileStream(new File(resourcesPath + "output/cipherTextFile.txt"), new File(resourcesPath + "output/plainTextDecFile.txt"))
.decrypt();
System.out.println("Encryption and decryption completed successfully.");
}
}