public byte[] decryptBytes(byte[] combined) throws IOException, InvalidMessageException { try { byte[][] parts = Util.split(combined, PublicKey.KEY_SIZE, combined.length - PublicKey.KEY_SIZE); PublicKey theirPublicKey = new PublicKey(parts[0], 0); ECPrivateKey ourPrivateKey = asymmetricMasterSecret.getPrivateKey(); byte[] secret = Curve.calculateAgreement(theirPublicKey.getKey(), ourPrivateKey); MasterCipher masterCipher = getMasterCipherForSecret(secret); return masterCipher.decryptBytes(parts[1]); } catch (InvalidKeyException e) { throw new InvalidMessageException(e); } }