summaryrefslogtreecommitdiff
path: root/src/org/noreply/fancydress/type3/ForwardLeg.java
blob: 4088d114de6cd2972b18d05ca4cb0c0488ec5305 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package org.noreply.fancydress.type3;

import org.noreply.fancydress.type3.routing.*;
import org.noreply.fancydress.status.*;
import org.noreply.fancydress.crypto.*;

public class ForwardLeg extends SingleLeg {
	private byte[][] sharedKeys;

	public ForwardLeg (HalfPath path, Routing finalRouting)
		throws Mix3BadArgumentsChainTooLongException
	{
		super();
		Hop[] hops = path.getHops();

		initSharedKeys(hops.length);
		makeLeg(hops, sharedKeys, finalRouting);
	};

	private void initSharedKeys(int n) {
		sharedKeys = new byte[n][];

		for (int i=0; i < n; i++)
			sharedKeys[i] = CryptoPrimitives.rand(CryptoPrimitives.KEY_LEN);
	}

	public byte[][] getSharedKeys() {
		return sharedKeys;
	}
}