@@ -0,0 +1,2338 @@
+package org.hive2hive.core.encryption;%0A%0Aimport javax.crypto.SecretKey;%0A%0Aimport org.bouncycastle.crypto.DataLengthException;%0Aimport org.bouncycastle.crypto.InvalidCipherTextException;%0Aimport org.hive2hive.core.network.data.NetworkContent;%0A%0Apublic final class H2HEncryptionUtil %7B%0A%0A%09private H2HEncryptionUtil() %7B%0A%09%09// only static%0A%09%7D%0A%0A%09/**%0A%09 * Symmetrically encrypts content inheriting from %7B@link NetworkContent%7D by means of the AES algorithm.%0A%09 * The content first gets serialized, then encrypted.%0A%09 * %0A%09 * @param content the content to be encrypted. Can be of any type that extends %7B@link NetworkContent%7D.%0A%09 * @param aesKey The symmetric key with which the content will be encrypted.%0A%09 * @return EncryptedContent which contains the encrypted byte%5B%5D content as well as the AES initialization%0A%09 *         vector (IV).%0A%09 * @throws InvalidCipherTextException%0A%09 * @throws IllegalStateException%0A%09 * @throws DataLengthException%0A%09 */%0A%09public static EncryptedNetworkContent encryptAES(NetworkContent content, SecretKey aesKey)%0A%09%09%09throws DataLengthException, IllegalStateException, InvalidCipherTextException %7B%0A%09%09byte%5B%5D serialized = EncryptionUtil.serializeObject(content);%0A%09%09byte%5B%5D initVector = EncryptionUtil.generateIV();%0A%09%09byte%5B%5D encryptedContent = EncryptionUtil.encryptAES(serialized, aesKey, initVector);%0A%0A%09%09EncryptedNetworkContent encryptedNetworkContent = new EncryptedNetworkContent(encryptedContent,%0A%09%09%09%09initVector);%0A%09%09encryptedNetworkContent.setTimeToLive(content.getTimeToLive());%0A%09%09return encryptedNetworkContent;%0A%09%7D%0A%0A%09/**%0A%09 * Symmetrically decrypts a prior content inheriting from %7B@link NetworkContent%7D by means of the AES%0A%09 * algorithm. The content gets deserialized after the decryption.%0A%09 * %0A%09 * @param content The EncryptedContent to be decrypted.%0A%09 * @param aesKey The symmetric key with which the content will be decrypted.%0A%09 * @return decrypted object%0A%09 * @throws InvalidCipherTextException%0A%09 * @throws IllegalStateException%0A%09 * @throws DataLengthException%0A%09 */%0A%09public static NetworkContent decryptAES(EncryptedNetworkContent content, SecretKey aesKey)%0A%09%09%09throws DataLengthException, IllegalStateException, InvalidCipherTextException %7B%0A%09%09byte%5B%5D decrypted = EncryptionUtil.decryptAES(content.getCipherContent(), aesKey,%0A%09%09%09%09content.getInitVector());%0A%09%09return (NetworkContent) EncryptionUtil.deserializeObject(decrypted);%0A%09%7D%0A%7D%0A

Add missing class