浏览代码

reduced visibility of some classes

Sebastian Stenzel 9 年之前
父节点
当前提交
cbb669aa40

+ 13 - 0
main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/Constants.java

@@ -0,0 +1,13 @@
+package org.cryptomator.crypto.engine.impl;
+
+public final class Constants {
+
+	private Constants() {
+	}
+
+	public static final int PAYLOAD_SIZE = 32 * 1024;
+	public static final int NONCE_SIZE = 16;
+	public static final int MAC_SIZE = 32;
+	public static final int CHUNK_SIZE = NONCE_SIZE + PAYLOAD_SIZE + MAC_SIZE;
+
+}

+ 4 - 6
main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FileContentCryptorImpl.java

@@ -8,6 +8,9 @@
  *******************************************************************************/
 package org.cryptomator.crypto.engine.impl;
 
+import static org.cryptomator.crypto.engine.impl.Constants.CHUNK_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.PAYLOAD_SIZE;
+
 import java.nio.ByteBuffer;
 import java.security.SecureRandom;
 import java.util.Optional;
@@ -19,12 +22,7 @@ import org.cryptomator.crypto.engine.FileContentCryptor;
 import org.cryptomator.crypto.engine.FileContentDecryptor;
 import org.cryptomator.crypto.engine.FileContentEncryptor;
 
-public class FileContentCryptorImpl implements FileContentCryptor {
-
-	public static final int PAYLOAD_SIZE = 32 * 1024;
-	public static final int NONCE_SIZE = 16;
-	public static final int MAC_SIZE = 32;
-	public static final int CHUNK_SIZE = NONCE_SIZE + PAYLOAD_SIZE + MAC_SIZE;
+class FileContentCryptorImpl implements FileContentCryptor {
 
 	private final SecretKey encryptionKey;
 	private final SecretKey macKey;

+ 3 - 3
main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FileContentDecryptorImpl.java

@@ -8,9 +8,9 @@
  *******************************************************************************/
 package org.cryptomator.crypto.engine.impl;
 
-import static org.cryptomator.crypto.engine.impl.FileContentCryptorImpl.CHUNK_SIZE;
-import static org.cryptomator.crypto.engine.impl.FileContentCryptorImpl.MAC_SIZE;
-import static org.cryptomator.crypto.engine.impl.FileContentCryptorImpl.NONCE_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.CHUNK_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.MAC_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.NONCE_SIZE;
 
 import java.io.IOException;
 import java.io.UncheckedIOException;

+ 2 - 2
main/filesystem-crypto/src/main/java/org/cryptomator/crypto/engine/impl/FileContentEncryptorImpl.java

@@ -8,8 +8,8 @@
  *******************************************************************************/
 package org.cryptomator.crypto.engine.impl;
 
-import static org.cryptomator.crypto.engine.impl.FileContentCryptorImpl.NONCE_SIZE;
-import static org.cryptomator.crypto.engine.impl.FileContentCryptorImpl.PAYLOAD_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.NONCE_SIZE;
+import static org.cryptomator.crypto.engine.impl.Constants.PAYLOAD_SIZE;
 
 import java.io.IOException;
 import java.io.UncheckedIOException;

+ 3 - 2
main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/blockaligned/BlockAlignedFileSystemFactory.java

@@ -8,10 +8,11 @@
  *******************************************************************************/
 package org.cryptomator.filesystem.blockaligned;
 
+import static org.cryptomator.crypto.engine.impl.Constants.PAYLOAD_SIZE;
+
 import javax.inject.Inject;
 import javax.inject.Singleton;
 
-import org.cryptomator.crypto.engine.impl.FileContentCryptorImpl;
 import org.cryptomator.filesystem.FileSystem;
 import org.cryptomator.filesystem.Folder;
 
@@ -23,6 +24,6 @@ public class BlockAlignedFileSystemFactory {
 	}
 
 	public FileSystem get(Folder root) {
-		return new BlockAlignedFileSystem(root, FileContentCryptorImpl.PAYLOAD_SIZE);
+		return new BlockAlignedFileSystem(root, PAYLOAD_SIZE);
 	}
 }

+ 1 - 1
main/filesystem-crypto/src/main/java/org/cryptomator/filesystem/crypto/CryptoFile.java

@@ -19,7 +19,7 @@ import org.cryptomator.filesystem.File;
 import org.cryptomator.filesystem.ReadableFile;
 import org.cryptomator.filesystem.WritableFile;
 
-public class CryptoFile extends CryptoNode implements File {
+class CryptoFile extends CryptoNode implements File {
 
 	public CryptoFile(CryptoFolder parent, String name, Cryptor cryptor) {
 		super(parent, name, cryptor);