/** * Decode data using session key. * * @param message the message * @return the byte[] * @throws GeneralSecurityException the general security exception */ public byte[] decodeData(byte[] message) throws GeneralSecurityException { if (sessionCipherPair == null) { sessionCipherPair = new CipherPair(SESSION_CRYPT_ALGORITHM, getSessionKey()); } return sessionCipherPair.decCipher.doFinal(message); }
/** * Encode data using sessionKey. * * @param message the message * @return the byte[] * @throws GeneralSecurityException the general security exception */ public byte[] encodeData(byte[] message) throws GeneralSecurityException { if (sessionCipherPair == null) { sessionCipherPair = new CipherPair(SESSION_CRYPT_ALGORITHM, getSessionKey()); } return sessionCipherPair.encCipher.doFinal(message); }