Running CipherExampleAES
The CipherExampleAES sample application uses the Entrust implementation of the AES cipher to encrypt and decrypt binary data.
To run this sample application, execute the following command line in the etjava/examples directory.
java -classpath classes;../lib/enttoolkit.jar com.entrust.toolkit.examples.crypto.CipherExampleAES [<key_size>]|
Parameter |
Value |
|
<key_size> |
The key size in bits: 128, 192 or 256. |
For example:
C:\etjava\examples>java -classpath classes;../lib/enttoolkit.jar com.entrust.toolkit.examples.crypto.CipherExampleAES 256Installing providers... DONEGenerating key using AES/CBC/PKCS5Padding... DONEEncrypting data... DONEinput plaintext: 00:01:02:03:04:05:06:07:08:09output ciphertext: AE:4E:F5:91:4D:F6:09:81:C6:65:14:7D:44:CD:DE:5DOCTET STRING = 16 bytes: 99:7A:72:B3:67...Decrypting data... DONEinput ciphertext: AE:4E:F5:91:4D:F6:09:81:C6:65:14:7D:44:CD:DE:5Doutput plaintext: 00:01:02:03:04:05:06:07:08:09OCTET STRING = 16 bytes: 99:7A:72:B3:67...Generating key using AES/GCM/NoPadding... DONEEncrypting data... DONEinput plaintext: 00:01:02:03:04:05:06:07:08:09output ciphertext: 13:B1:9C:7E:CD:FE:C5:45:B4:1A:BE:29:33:C1:1C:2D:DE:7C:A3:79:07:A1:70:7F:8B:51IV and tLen parameters: SEQUENCE[C] = 2 elementsOCTET STRING = 12 bytes: B8:E0:46:4B:E2...INTEGER = 16Decrypting data... DONEinput ciphertext: 13:B1:9C:7E:CD:FE:C5:45:B4:1A:BE:29:33:C1:1C:2D:DE:7C:A3:79:07:A1:70:7F:8B:51output plaintext: 00:01:02:03:04:05:06:07:08:09IV and tLen parameters: SEQUENCE[C] = 2 elementsOCTET STRING = 12 bytes: B8:E0:46:4B:E2...INTEGER = 16