Пример #1
0
  @Test
  public void testIsEncryptedFileFalse() throws Exception {
    File tempDirectory = TestFileUtil.createTempDirectoryInSystemTemp();
    File testFile = new File(tempDirectory + "/somefile");

    FileUtil.writeToFile(new byte[] {1, 2, 3}, testFile);
    assertFalse(CipherUtil.isEncrypted(testFile));

    TestFileUtil.deleteDirectory(tempDirectory);
  }
Пример #2
0
  @Test
  public void testIsEncryptedFileTrue() throws Exception {
    File tempDirectory = TestFileUtil.createTempDirectoryInSystemTemp();
    File testFile = new File(tempDirectory + "/somefile");

    RandomAccessFile testFileRaf = new RandomAccessFile(testFile, "rw");

    testFileRaf.write(MultiCipherOutputStream.STREAM_MAGIC);
    testFileRaf.write(MultiCipherOutputStream.STREAM_VERSION);
    testFileRaf.close();

    assertTrue(CipherUtil.isEncrypted(testFile));

    TestFileUtil.deleteDirectory(tempDirectory);
  }