@Test(expected = NotfoundException.class) public void testToEncryptedInvalidArgument() throws Exception { final Path home = new Path("/vault", EnumSet.of(Path.Type.directory)); final CryptoVault vault = new CryptoVault(home); final CryptoDirectory provider = new CryptoDirectoryV7Provider(home, vault); provider.toEncrypted(new NullSession(new Host(new TestProtocol())), null, new Path("/vault/f", EnumSet.of(Path.Type.file))); }
@Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String ciphertextName = cryptomator.getFileNameCryptor().encryptFilename(BaseEncoding.base64Url(), filename, directoryId.getBytes(StandardCharsets.UTF_8)) + EXTENSION_REGULAR; if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); }
CryptoDirectoryV7Provider extends CryptoDirectoryV6Provider { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String ciphertextName = cryptomator.getFileNameCryptor().encryptFilename(BaseEncoding.base64Url(), filename, directoryId.getBytes(StandardCharsets.UTF_8)) + EXTENSION_REGULAR; if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } }
CryptoDirectoryV7Provider extends CryptoDirectoryV6Provider { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String ciphertextName = cryptomator.getFileNameCryptor().encryptFilename(BaseEncoding.base64Url(), filename, directoryId.getBytes(StandardCharsets.UTF_8)) + EXTENSION_REGULAR; if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV7Provider(final Path vault, final CryptoVault cryptomator); }
CryptoDirectoryV7Provider extends CryptoDirectoryV6Provider { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String ciphertextName = cryptomator.getFileNameCryptor().encryptFilename(BaseEncoding.base64Url(), filename, directoryId.getBytes(StandardCharsets.UTF_8)) + EXTENSION_REGULAR; if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV7Provider(final Path vault, final CryptoVault cryptomator); @Override String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type); }
CryptoDirectoryV7Provider extends CryptoDirectoryV6Provider { @Override public String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type) throws BackgroundException { final String ciphertextName = cryptomator.getFileNameCryptor().encryptFilename(BaseEncoding.base64Url(), filename, directoryId.getBytes(StandardCharsets.UTF_8)) + EXTENSION_REGULAR; if(log.isDebugEnabled()) { log.debug(String.format("Encrypted filename %s to %s", filename, ciphertextName)); } return cryptomator.getFilenameProvider().deflate(session, ciphertextName); } CryptoDirectoryV7Provider(final Path vault, final CryptoVault cryptomator); @Override String toEncrypted(final Session<?> session, final String directoryId, final String filename, final EnumSet<Path.Type> type); static final String EXTENSION_REGULAR; static final String FILENAME_DIRECTORYID; static final String DIRECTORY_METADATAFILE; }