// 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/common/SecureRandomMock.java
// public class SecureRandomMock extends SecureRandom {
// 
// 	private static final ByteFiller NULL_FILLER = bytes -> Arrays.fill(bytes, (byte) 0x00);
// 	public static final SecureRandomMock NULL_RANDOM = new SecureRandomMock(NULL_FILLER);
// 	private static final ByteFiller PRNG_FILLER = new ByteFiller() {
// 
// 		private final Random random = new Random();
// 
// 		@Override
// 		public void fill(byte[] bytes) {
// 			random.nextBytes(bytes);
// 		}
// 
// 	};
// 	public static final SecureRandomMock PRNG_RANDOM = new SecureRandomMock(PRNG_FILLER);
// 
// 	private final ByteFiller byteFiller;
// 
// 	public SecureRandomMock(ByteFiller byteFiller) {
// 		this.byteFiller = byteFiller;
// 	}
// 
// 	@Override
// 	public void nextBytes(byte[] bytes) {
// 		byteFiller.fill(bytes);
// 	}
// 
// 	public static SecureRandomMock cycle(byte... bytes) {
// 		return new SecureRandomMock(new CyclicByteFiller(bytes));
// 	}
// 
// 	public interface ByteFiller {
// 		void fill(byte[] bytes);
// 	}
// 
// 	private static class CyclicByteFiller implements ByteFiller {
// 
// 		private final Iterator<Byte> source;
// 
// 		CyclicByteFiller(byte... bytes) {
// 			source = Iterators.cycle(Bytes.asList(bytes));
// 		}
// 
// 		@Override
// 		public void fill(byte[] bytes) {
// 			Arrays.fill(bytes, source.next());
// 		}
// 
// 	}
// 
// }


import org.cryptomator.cryptolib.api.Masterkey;
import org.cryptomator.cryptolib.common.SecureRandomMock;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.security.SecureRandom;
/*******************************************************************************
 * Copyright (c) 2016 Sebastian Stenzel and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the accompanying LICENSE.txt.
 *
 * Contributors:
 *     Sebastian Stenzel - initial API and implementation
 *******************************************************************************/
package org.cryptomator.cryptolib.v2;



public class CryptorProviderImplTest {

	private static final SecureRandom RANDOM_MOCK = SecureRandomMock.NULL_RANDOM;

	@Test
	public void testProvide() {
// 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/common/SecureRandomMock.java
// public class SecureRandomMock extends SecureRandom {
// 
// 	private static final ByteFiller NULL_FILLER = bytes -> Arrays.fill(bytes, (byte) 0x00);
// 	public static final SecureRandomMock NULL_RANDOM = new SecureRandomMock(NULL_FILLER);
// 	private static final ByteFiller PRNG_FILLER = new ByteFiller() {
// 
// 		private final Random random = new Random();
// 
// 		@Override
// 		public void fill(byte[] bytes) {
// 			random.nextBytes(bytes);
// 		}
// 
// 	};
// 	public static final SecureRandomMock PRNG_RANDOM = new SecureRandomMock(PRNG_FILLER);
// 
// 	private final ByteFiller byteFiller;
// 
// 	public SecureRandomMock(ByteFiller byteFiller) {
// 		this.byteFiller = byteFiller;
// 	}
// 
// 	@Override
// 	public void nextBytes(byte[] bytes) {
// 		byteFiller.fill(bytes);
// 	}
// 
// 	public static SecureRandomMock cycle(byte... bytes) {
// 		return new SecureRandomMock(new CyclicByteFiller(bytes));
// 	}
// 
// 	public interface ByteFiller {
// 		void fill(byte[] bytes);
// 	}
// 
// 	private static class CyclicByteFiller implements ByteFiller {
// 
// 		private final Iterator<Byte> source;
// 
// 		CyclicByteFiller(byte... bytes) {
// 			source = Iterators.cycle(Bytes.asList(bytes));
// 		}
// 
// 		@Override
// 		public void fill(byte[] bytes) {
// 			Arrays.fill(bytes, source.next());
// 		}
// 
// 	}
// 
// }


// Path: src/test/java/org/cryptomator/cryptolib/v2/CryptorProviderImplTest.java
import org.cryptomator.cryptolib.api.Masterkey;
import org.cryptomator.cryptolib.common.SecureRandomMock;
import org.junit.jupiter.api.Assertions;
import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.Test;
import org.mockito.Mockito;
import java.security.SecureRandom;

/*******************************************************************************
 * Copyright (c) 2016 Sebastian Stenzel and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the accompanying LICENSE.txt.
 *
 * Contributors:
 *     Sebastian Stenzel - initial API and implementation
 *******************************************************************************/
package org.cryptomator.cryptolib.v2;



public class CryptorProviderImplTest {

	private static final SecureRandom RANDOM_MOCK = SecureRandomMock.NULL_RANDOM;

	@Test
	public void testProvide() {
		Masterkey masterkey = Mockito.mock(Masterkey.class);