@Test(expected = NotfoundException.class) public void testToEncryptedInvalidPath() throws Exception { final Path home = new Path("/vault", EnumSet.of(Path.Type.directory)); final CryptoVault vault = new CryptoVault(home); final CryptoDirectory provider = new CryptoDirectoryV6Provider(home, vault); provider.toEncrypted(new NullSession(new Host(new TestProtocol())), null, new Path("/", EnumSet.of(Path.Type.directory))); }
@Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String prefix = type.contains(Path.Type.directory) ? CryptoVault.DIR_PREFIX : ""; final String ciphertextName = prefix + cryptomator.getFileNameCryptor().encryptFilename(CryptorCache.BASE32, filename, directoryId.getBytes(StandardCharsets.UTF_8)); if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); }
CryptoDirectoryV6Provider implements CryptoDirectory { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String prefix = type.contains(Path.Type.directory) ? CryptoVault.DIR_PREFIX : ""; final String ciphertextName = prefix + cryptomator.getFileNameCryptor().encryptFilename(CryptorCache.BASE32, filename, directoryId.getBytes(StandardCharsets.UTF_8)); if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } }
CryptoDirectoryV6Provider implements CryptoDirectory { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String prefix = type.contains(Path.Type.directory) ? CryptoVault.DIR_PREFIX : ""; final String ciphertextName = prefix + cryptomator.getFileNameCryptor().encryptFilename(CryptorCache.BASE32, filename, directoryId.getBytes(StandardCharsets.UTF_8)); if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV6Provider(final Path vault, final CryptoVault cryptomator); }
CryptoDirectoryV6Provider implements CryptoDirectory { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String prefix = type.contains(Path.Type.directory) ? CryptoVault.DIR_PREFIX : ""; final String ciphertextName = prefix + cryptomator.getFileNameCryptor().encryptFilename(CryptorCache.BASE32, filename, directoryId.getBytes(StandardCharsets.UTF_8)); if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV6Provider(final Path vault, final CryptoVault cryptomator); @Override String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type); @Override Path toEncrypted(final Session<?> session, final String directoryId, final Path directory); void delete(final Path directory); @Override void destroy(); }
CryptoDirectoryV6Provider implements CryptoDirectory { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String prefix = type.contains(Path.Type.directory) ? CryptoVault.DIR_PREFIX : ""; final String ciphertextName = prefix + cryptomator.getFileNameCryptor().encryptFilename(CryptorCache.BASE32, filename, directoryId.getBytes(StandardCharsets.UTF_8)); if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV6Provider(final Path vault, final CryptoVault cryptomator); @Override String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type); @Override Path toEncrypted(final Session<?> session, final String directoryId, final Path directory); void delete(final Path directory); @Override void destroy();  }