// Path: src/main/java/org/cryptomator/cryptolib/api/AuthenticationFailedException.java
// public class AuthenticationFailedException extends CryptoException {
// 
// 	public AuthenticationFailedException(String message) {
// 		super(message);
// 	}
// 
// 	public AuthenticationFailedException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/Masterkey.java
// public class Masterkey extends DestroyableSecretKey {
// 
// 	private static final String KEY_ALGORITHM = "MASTERKEY";
// 	public static final String ENC_ALG = "AES";
// 	public static final String MAC_ALG = "HmacSHA256";
// 	public static final int SUBKEY_LEN_BYTES = 32;
// 
// 	public Masterkey(byte[] key) {
// 		super(checkKeyLength(key), KEY_ALGORITHM);
// 	}
// 
// 	private static byte[] checkKeyLength(byte[] key) {
// 		Preconditions.checkArgument(key.length == SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES, "Invalid raw key length %s", key.length);
// 		return key;
// 	}
// 
// 	public static Masterkey generate(SecureRandom csprng) {
// 		byte[] key = new byte[SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES];
// 		try {
// 			csprng.nextBytes(key);
// 			return new Masterkey(key);
// 		} finally {
// 			Arrays.fill(key, (byte) 0x00);
// 		}
// 	}
// 
// 	public static Masterkey from(DestroyableSecretKey encKey, DestroyableSecretKey macKey) {
// 		Preconditions.checkArgument(encKey.getEncoded().length == SUBKEY_LEN_BYTES, "Invalid key length of encKey");
// 		Preconditions.checkArgument(macKey.getEncoded().length == SUBKEY_LEN_BYTES, "Invalid key length of macKey");
// 		byte[] key = new byte[SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES];
// 		try {
// 			System.arraycopy(encKey.getEncoded(), 0, key, 0, SUBKEY_LEN_BYTES);
// 			System.arraycopy(macKey.getEncoded(), 0, key, SUBKEY_LEN_BYTES, SUBKEY_LEN_BYTES);
// 			return new Masterkey(key);
// 		} finally {
// 			Arrays.fill(key, (byte) 0x00);
// 		}
// 	}
// 
// 	@Override
// 	public Masterkey copy() {
// 		return new Masterkey(getEncoded());
// 	}
// 
// 	/**
// 	 * Get the encryption subkey.
// 	 *
// 	 * @return A new copy of the subkey used for encryption
// 	 */
// 	public DestroyableSecretKey getEncKey() {
// 		return new DestroyableSecretKey(getEncoded(), 0, SUBKEY_LEN_BYTES, ENC_ALG);
// 	}
// 
// 	/**
// 	 * Get the MAC subkey.
// 	 *
// 	 * @return A new copy of the subkey used for message authentication
// 	 */
// 	public DestroyableSecretKey getMacKey() {
// 		return new DestroyableSecretKey(getEncoded(), SUBKEY_LEN_BYTES, SUBKEY_LEN_BYTES, MAC_ALG);
// 	}
// 
// }


import com.google.common.io.BaseEncoding;
import org.cryptomator.cryptolib.api.AuthenticationFailedException;
import org.cryptomator.cryptolib.api.Masterkey;
import org.cryptomator.siv.UnauthenticCiphertextException;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.UUID;
import java.util.stream.Stream;
import static java.nio.charset.StandardCharsets.UTF_8;
/*******************************************************************************
 * Copyright (c) 2015, 2016 Sebastian Stenzel and others.
 * This file is licensed under the terms of the MIT license.
 * See the LICENSE.txt file for more info.
 *
 * Contributors:
 *     Sebastian Stenzel - initial API and implementation
 *******************************************************************************/
package org.cryptomator.cryptolib.v2;





public class FileNameCryptorImplTest {

	private static final BaseEncoding BASE32 = BaseEncoding.base32();

// Path: src/main/java/org/cryptomator/cryptolib/api/AuthenticationFailedException.java
// public class AuthenticationFailedException extends CryptoException {
// 
// 	public AuthenticationFailedException(String message) {
// 		super(message);
// 	}
// 
// 	public AuthenticationFailedException(String message, Throwable cause) {
// 		super(message, cause);
// 	}
// 
// }
// 
// Path: src/main/java/org/cryptomator/cryptolib/api/Masterkey.java
// public class Masterkey extends DestroyableSecretKey {
// 
// 	private static final String KEY_ALGORITHM = "MASTERKEY";
// 	public static final String ENC_ALG = "AES";
// 	public static final String MAC_ALG = "HmacSHA256";
// 	public static final int SUBKEY_LEN_BYTES = 32;
// 
// 	public Masterkey(byte[] key) {
// 		super(checkKeyLength(key), KEY_ALGORITHM);
// 	}
// 
// 	private static byte[] checkKeyLength(byte[] key) {
// 		Preconditions.checkArgument(key.length == SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES, "Invalid raw key length %s", key.length);
// 		return key;
// 	}
// 
// 	public static Masterkey generate(SecureRandom csprng) {
// 		byte[] key = new byte[SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES];
// 		try {
// 			csprng.nextBytes(key);
// 			return new Masterkey(key);
// 		} finally {
// 			Arrays.fill(key, (byte) 0x00);
// 		}
// 	}
// 
// 	public static Masterkey from(DestroyableSecretKey encKey, DestroyableSecretKey macKey) {
// 		Preconditions.checkArgument(encKey.getEncoded().length == SUBKEY_LEN_BYTES, "Invalid key length of encKey");
// 		Preconditions.checkArgument(macKey.getEncoded().length == SUBKEY_LEN_BYTES, "Invalid key length of macKey");
// 		byte[] key = new byte[SUBKEY_LEN_BYTES + SUBKEY_LEN_BYTES];
// 		try {
// 			System.arraycopy(encKey.getEncoded(), 0, key, 0, SUBKEY_LEN_BYTES);
// 			System.arraycopy(macKey.getEncoded(), 0, key, SUBKEY_LEN_BYTES, SUBKEY_LEN_BYTES);
// 			return new Masterkey(key);
// 		} finally {
// 			Arrays.fill(key, (byte) 0x00);
// 		}
// 	}
// 
// 	@Override
// 	public Masterkey copy() {
// 		return new Masterkey(getEncoded());
// 	}
// 
// 	/**
// 	 * Get the encryption subkey.
// 	 *
// 	 * @return A new copy of the subkey used for encryption
// 	 */
// 	public DestroyableSecretKey getEncKey() {
// 		return new DestroyableSecretKey(getEncoded(), 0, SUBKEY_LEN_BYTES, ENC_ALG);
// 	}
// 
// 	/**
// 	 * Get the MAC subkey.
// 	 *
// 	 * @return A new copy of the subkey used for message authentication
// 	 */
// 	public DestroyableSecretKey getMacKey() {
// 		return new DestroyableSecretKey(getEncoded(), SUBKEY_LEN_BYTES, SUBKEY_LEN_BYTES, MAC_ALG);
// 	}
// 
// }


// Path: src/test/java/org/cryptomator/cryptolib/v2/FileNameCryptorImplTest.java
import com.google.common.io.BaseEncoding;
import org.cryptomator.cryptolib.api.AuthenticationFailedException;
import org.cryptomator.cryptolib.api.Masterkey;
import org.cryptomator.siv.UnauthenticCiphertextException;
import org.hamcrest.CoreMatchers;
import org.hamcrest.MatcherAssert;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.params.ParameterizedTest;
import org.junit.jupiter.params.provider.MethodSource;
import java.util.UUID;
import java.util.stream.Stream;
import static java.nio.charset.StandardCharsets.UTF_8;

/*******************************************************************************
 * Copyright (c) 2015, 2016 Sebastian Stenzel and others.
 * This file is licensed under the terms of the MIT license.
 * See the LICENSE.txt file for more info.
 *
 * Contributors:
 *     Sebastian Stenzel - initial API and implementation
 *******************************************************************************/
package org.cryptomator.cryptolib.v2;





public class FileNameCryptorImplTest {

	private static final BaseEncoding BASE32 = BaseEncoding.base32();

	private final Masterkey masterkey = new Masterkey(new byte[64]);