1515 * See the License for the specific language governing permissions and
1616 * limitations under the License.
1717 */
18- package de .dominikschadow .javasecurity .tink .symmetric ;
18+ package de .dominikschadow .javasecurity .tink .aead ;
1919
2020import com .google .crypto .tink .Aead ;
2121import com .google .crypto .tink .KeysetHandle ;
3030
3131/**
3232 * Shows crypto usage with Google Tink for the Authenticated Encryption with Associated Data (AEAD) primitive. The used
33- * key is generated during runtime and not saved.
33+ * key is generated during runtime and not saved. Selected algorithm is AES-EAX with 256 bit.
3434 *
3535 * @author Dominik Schadow
3636 */
37- public class AeadDemo {
38- private static final Logger log = LoggerFactory .getLogger (AeadDemo .class );
37+ public class AesEaxWithGeneratedKey {
38+ private static final Logger log = LoggerFactory .getLogger (AesEaxWithGeneratedKey .class );
3939 private static final String INITIAL_TEXT = "Some dummy text to work with" ;
4040 private static final String ASSOCIATED_DATA = "Some additional data" ;
4141
4242 /**
4343 * Init AeadConfig in the Tink library.
4444 */
45- private AeadDemo () {
45+ private AesEaxWithGeneratedKey () {
4646 try {
4747 AeadConfig .register ();
4848 } catch (GeneralSecurityException ex ) {
@@ -51,7 +51,7 @@ private AeadDemo() {
5151 }
5252
5353 public static void main (String [] args ) {
54- AeadDemo demo = new AeadDemo ();
54+ AesEaxWithGeneratedKey demo = new AesEaxWithGeneratedKey ();
5555
5656 try {
5757 KeysetHandle keysetHandle = demo .generateKey ();
@@ -66,7 +66,7 @@ public static void main(String[] args) {
6666 }
6767
6868 private KeysetHandle generateKey () throws GeneralSecurityException {
69- return KeysetHandle .generateNew (AeadKeyTemplates .AES128_GCM );
69+ return KeysetHandle .generateNew (AeadKeyTemplates .AES256_EAX );
7070 }
7171
7272 private byte [] encrypt (KeysetHandle keysetHandle ) throws GeneralSecurityException {
0 commit comments