/crypto-service

AES and TOTP based crypto service

Primary LanguageJava

Crypto Service

Combining AES with TOTP for a more secure AES encryption. (java implementation)

A new AES key is generated every 30 seconds with the TOTP algorithm. The client needs the original AES key to decrypt the messages but the key-synchronization happens with the help of the TOTP.

Usage

CryptoService cs = new CryptoService(secret.getBytes(), ivParam.getBytes(), ivParamTimeBased.getBytes());
ByteBuffer buffer = ByteBuffer.wrap("foobar".getBytes());
ByteBuffer encryptedBuffer = cs.encryptTimeBased(buffer);
ByteBuffer decryptedBuffer = cs.decryptTimeBased(encryptedBuffer);
System.out.println(new String(decryptedBuffer.array()));